/* ith.chat — стили. Язык «Сообщений» iOS, тёмная тема (как приложение ith.mon с экрана «Домой»).
   Макет — холст https://claude.ai/artifact/HMijeKae6bPpG5jpyUjRvo; замечания пользователя 20.10.2026: список чатов —
   как в «Сообщениях», без крупных кружков; верхняя панель — непрозрачная, кнопка меню справа.
   Строгая CSP: никаких style="" в разметке — только классы; переменные значения ставит скрипт через element.style. */

:root {
  --bg: #000000; --cell: #1C1C1E; --cell2: #2C2C2E; --sep: #38383A;
  --label: #FFFFFF; --label2: #D1D1D6; --muted: #98989F; --chev: #5A5A5E;
  --tint: #0A84FF; --tint-text: #409CFF; --bubble: #1B6EF3;        /* синий кнопок: белый текст на нём — 4,6:1 */
  --them: #26252A;                                                  /* пузырь собеседника */
  --danger: #FF6961; --ok: #30D158;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--label); font: 17px/1.3 var(--font);
  -webkit-tap-highlight-color: transparent; }
/* Прозрачный верх (black-translucent): окно на iOS 26/27 ниже экрана на строку с часами — тянемся на 100lvh
   (GRABLI ith.mon «Прозрачный верх»). */
html.standalone body { min-height: 100lvh; }
body.inconv { overflow: hidden; }
a { color: var(--tint-text); text-decoration: none; }
button { font: inherit; color: inherit; }
input, textarea { font: inherit; }
[hidden] { display: none !important; }

/* Верхняя панель: непрозрачная, на всю ширину, прилипает к верху. Под часами — её же чёрный фон. */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: var(--sat); }
.bi { max-width: 600px; margin: 0 auto; min-height: 44px; padding: 0 8px; display: flex; align-items: center;
  justify-content: space-between; }
.bk { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; padding-right: 8px;
  color: var(--tint-text); font-size: 17px; }
.ib { width: 44px; height: 44px; border: 0; padding: 0; background: none; color: var(--tint-text); display: flex;
  align-items: center; justify-content: center; cursor: pointer; }

/* Экран: колонка по центру, отступ под часами и полоской «домой». Под панелью отступ сверху даёт панель. */
.scr { max-width: 600px; margin: 0 auto; padding: calc(var(--sat) + 6px) 16px calc(var(--sab) + 28px); }
.bar + .scr { padding-top: 0; }
.scr.narrow { max-width: 440px; }
.lt { margin: 2px 0 8px; font-size: 34px; font-weight: 700; letter-spacing: .01em; }
.sh { margin: 22px 16px 6px; font-size: 13px; font-weight: 400; color: var(--muted); text-transform: uppercase; }
.empty { margin: 40px 0; text-align: center; color: var(--muted); }

/* Список чатов — как в «Сообщениях»: точка непрочитанного, аватар, имя и время, две строки последнего сообщения.
   Разделитель — от текста до края. */
.cl { margin: 4px -16px 0; }
.cr { display: grid; grid-template-columns: 18px 44px minmax(0, 1fr); align-items: center; column-gap: 10px;
  padding: 0 16px 0 0; color: var(--label); }
.cr:active { background: var(--cell); }
.ud { justify-self: end; width: 10px; height: 10px; border-radius: 5px; }
.cr.unread .ud { background: var(--tint); }
.cc { min-height: 76px; padding: 10px 0; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  border-bottom: .5px solid var(--sep); }
.cr:last-child .cc { border-bottom: 0; }
.c1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cn { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm { flex: none; display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--muted); }
.cp { font-size: 15px; line-height: 1.3; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* Переписка: окно ровно по видимой области (высоту и сдвиг при клавиатуре ставит скрипт по visualViewport). */
.conv { position: fixed; left: 0; right: 0; top: 0; height: 100%; display: flex; flex-direction: column;
  background: var(--bg); }
.conv .bar { position: relative; border-bottom: .5px solid var(--sep); }
.cb .bi { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; max-width: 760px; min-height: 62px; }
.who { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; font-size: 12px; }
.wn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { margin: 0; padding: 8px 16px; background: var(--cell); color: var(--muted); font-size: 13px; text-align: center; }
.msgs { flex: 1; min-height: 0; width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 16px 10px; overflow-y: auto;
  overscroll-behavior: contain; display: flex; flex-direction: column; }
.msgs > :first-child { margin-top: auto; }       /* мало сообщений — прижаты к полю ввода, как в «Сообщениях» */
.ts { align-self: center; padding: 12px 0 4px; font-size: 12px; color: var(--muted); }
.ts b { font-weight: 600; }

/* Пузыри. Хвостик — два псевдоэлемента: цветная «капля» и вырез цветом фона (как в макете Direct). */
.b { position: relative; z-index: 0; max-width: min(75%, 520px); margin-top: 2px; padding: 7px 12px; border-radius: 18px;
  font-size: 17px; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere; }
.b.first { margin-top: 10px; }
.b.them { align-self: flex-start; background: var(--them); }
.b.me { align-self: flex-end; background: var(--bubble); color: #FFFFFF; }
.b.tail::before, .b.tail::after { content: ""; position: absolute; z-index: -1; bottom: 0; height: 20px; }
.b.tail.them::before { left: -7px; width: 20px; background: var(--them); border-bottom-right-radius: 16px 14px; }
.b.tail.them::after { left: -26px; width: 26px; background: var(--bg); border-bottom-right-radius: 10px; }
.b.tail.me::before { right: -7px; width: 20px; background: var(--bubble); border-bottom-left-radius: 16px 14px; }
.b.tail.me::after { right: -26px; width: 26px; background: var(--bg); border-bottom-left-radius: 10px; }
.b.pending, .b.failed { opacity: .55; }
.b.bad { color: var(--muted); font-style: italic; }
.fail { align-self: flex-end; margin-top: 3px; padding: 2px 0; border: 0; background: none; color: var(--danger);
  font-size: 12px; cursor: pointer; }

/* Поле ввода: растёт до 6 строк; над клавиатурой полоска «домой» не нужна — отступ меньше. */
.composer { width: 100%; max-width: 760px; margin: 0 auto; padding: 6px 12px calc(var(--sab) + 8px); }
.conv.kb .composer { padding-bottom: 8px; }
.cbox { display: flex; align-items: flex-end; gap: 6px; min-height: 38px; padding: 3px 3px 3px 14px; border: 1px solid #3A3A3C;
  border-radius: 19px; }
.cbox textarea { flex: 1; min-width: 0; max-height: 132px; padding: 5px 0; border: 0; outline: none; resize: none;
  background: transparent; color: var(--label); font-size: 17px; line-height: 22px; }  /* 17 px: при меньшем Safari увеличивает страницу */
.cbox textarea::placeholder { color: var(--muted); }
.send { flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 15px; background: var(--bubble);
  color: #FFFFFF; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.send:disabled { background: #3A3A3C; color: #8E8E93; cursor: default; }

/* Сгруппированный список (inset grouped). Разделитель — у внутренней части строки, после значка. */
.group { background: var(--cell); border-radius: 12px; overflow: hidden; margin-top: 18px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 0 0 16px; border: 0;
  background: transparent; color: var(--label); text-align: left; cursor: pointer; }
.row > .rw { flex: 1; min-width: 0; min-height: 46px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 16px 8px 0; border-bottom: .5px solid var(--sep); }
.row:last-child > .rw { border-bottom: 0; }
.row .val { color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.row .sub { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.row .t { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row.danger { color: var(--danger); }
.row.danger > .rw { justify-content: center; }      /* «Выйти» — по центру, как в «Настройках» iOS */
.row.tint { color: var(--tint-text); }
.row:active { background: var(--cell2); }
div.row, div.row:active { cursor: default; background: transparent; }
.ico { width: 29px; height: 29px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: none;
  color: #FFFFFF; }
.ico.green { background: #30A14E; } .ico.blue { background: var(--bubble); } .ico.gray { background: #636366; }
.chev { color: var(--chev); flex: none; }
.rbtn { border: 0; background: none; color: var(--danger); padding: 6px 0; min-height: 36px; cursor: pointer; font-size: 15px; }

/* Аватары: инициалы на сером градиенте, как монограммы «Контактов». */
.av { border-radius: 50%; background: linear-gradient(180deg, #6E6E73, #48484A); color: #FFFFFF; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex: none; }
.av.s { width: 34px; height: 34px; font-size: 15px; }
.av.m { width: 44px; height: 44px; font-size: 18px; }

/* Заставка входа и регистрации. */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 8px 6px; }
.hero h1 { margin: 6px 0 0; font-size: 28px; font-weight: 700; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.appicon { width: 76px; height: 76px; border-radius: 18px; }
.bigico { width: 76px; height: 76px; border-radius: 20px; background: var(--cell2); color: var(--ok); display: flex;
  align-items: center; justify-content: center; }

/* Поля формы — строками в группе, подпись слева, как в «Настройках». */
.fld { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; border-bottom: .5px solid var(--sep); }
.fld:last-child { border-bottom: 0; }
.fld > span { width: 76px; flex: none; color: var(--label); }
.fld input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--label); font-size: 17px;
  padding: 12px 0; }  /* 17 px: при шрифте меньше 16 px Safari увеличивает страницу при вводе */
.fld input::placeholder { color: var(--muted); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; margin-top: 18px;
  border: 0; border-radius: 14px; background: var(--bubble); color: #FFFFFF; font-size: 17px; font-weight: 600;
  cursor: pointer; text-align: center; }
.btn.secondary { background: var(--cell2); color: var(--label); }
.btn:disabled { opacity: .5; }
.link { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 10px; min-height: 44px;
  border: 0; background: none; color: var(--tint-text); font-size: 17px; cursor: pointer; text-align: center; }
.err { margin: 12px 16px 0; color: var(--danger); font-size: 15px; min-height: 1em; text-align: center; }
.foot { margin: 28px 16px 0; font-size: 13px; color: var(--muted); text-align: center; }

/* Шаги установки на экран «Домой». */
.steps { margin: 22px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px;
  background: var(--cell); border-bottom: .5px solid var(--sep); }
.steps li:first-child { border-radius: 12px 12px 0 0; } .steps li:last-child { border-radius: 0 0 12px 12px; border-bottom: 0; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 13px; background: var(--cell2);
  color: var(--label2); font-size: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.steps svg { vertical-align: -4px; color: var(--tint-text); }

/* Карточка-предложение (Face ID) на главном экране. */
.card { margin-top: 10px; background: var(--cell); border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px;
  align-items: center; }
.card .ct { flex: 1; min-width: 0; }
.card b { display: block; font-weight: 600; }
.card small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.card .act { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.card .act button { border: 0; background: none; color: var(--tint-text); cursor: pointer; padding: 4px 0; font-size: 15px; }
.card .act button.pri { font-weight: 600; }

/* Окно в стиле iOS (alert). */
dialog#dlg { border: 0; padding: 0; border-radius: 14px; background: rgba(44, 44, 46, .97); color: var(--label);
  width: min(300px, calc(100vw - 48px)); box-shadow: 0 18px 50px rgba(0, 0, 0, .6); }
dialog#dlg::backdrop { background: rgba(0, 0, 0, .5); }
.dl-b { padding: 18px 16px 14px; text-align: center; }
.dl-b h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dl-b p { margin: 6px 0 0; font-size: 13px; color: var(--label2); line-height: 1.35; word-break: break-word; }
.dl-b input { margin-top: 12px; width: 100%; padding: 8px 10px; border-radius: 8px; border: .5px solid var(--sep);
  background: var(--bg); color: var(--label); font-size: 16px; }
.dl-a { display: flex; border-top: .5px solid var(--sep); }
.dl-a.col { flex-direction: column; }
.dl-a button { flex: 1; min-height: 46px; border: 0; background: none; color: var(--tint-text); font-size: 17px; cursor: pointer; }
.dl-a:not(.col) button + button { border-left: .5px solid var(--sep); }
.dl-a.col button + button { border-top: .5px solid var(--sep); }
.dl-a button.bold { font-weight: 600; }
/* Окно ставит фокус на первую кнопку — рамку фокуса показываем только при работе с клавиатуры (в iOS её нет). */
.dl-a button:focus { outline: none; }
.dl-a button:focus-visible { background: rgba(255, 255, 255, .08); }
.dl-a button.danger { color: var(--danger); }

/* Выпадающее меню «…» — непрозрачное, под кнопкой (место ставит скрипт). */
dialog#menu { position: fixed; inset: auto; margin: 0; padding: 0; border: 0; border-radius: 13px; background: var(--cell2);
  color: var(--label); min-width: 230px; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, .6); }
dialog#menu::backdrop { background: rgba(0, 0, 0, .3); }
#menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 46px;
  padding: 0 16px; border: 0; background: none; color: var(--label); font-size: 17px; text-align: left; cursor: pointer; }
#menu button + button { border-top: .5px solid var(--sep); }
#menu button:active { background: #3A3A3C; }
#menu button:focus { outline: none; }
#menu button:focus-visible { background: #3A3A3C; }
