/* Cool.Easy.English — Mini App prototype.
   Brand colours taken from cooleasyenglish.ru computed styles. */

@font-face {
  /* Положите файл шрифта сайта в webapp/fonts/, пока его нет — работает Amatic SC */
  font-family: "AubreyPro";
  src: url("../fonts/AubreyPro.woff2") format("woff2"), url("../fonts/AubreyPro.woff") format("woff");
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #faf8f0;
  --card: #FDF1B3;
  --card-ink: #000000;
  --yellow: #F7DF57;
  --accent: #FF698E;
  --accent-soft: #FFE3EA;
  --accent-ink: #ffffff;
  --text: #000000;
  --muted: #6d6a60;
  --line: #EEE8D2;
  --regular: #C9EEC0;
  --regular-ink: #1d5e27;
  --ok: #23964a;
  --wait: #d18f00;
  --danger: #e5484d;
  --done-bg: #ECEAE2;
  --bubble-in: #F3F1EA;
  --shadow: 0 8px 24px rgba(30, 20, 0, .08);
  --today-tint: rgba(247, 223, 87, .14);
  --font-display: "AubreyPro", "Amatic SC", "Arimo", sans-serif;
  --font-text: "Arimo", Arial, sans-serif;
  --r-card: 20px;
  --r-pill: 1000px;
  --tabbar-h: 72px;
  color-scheme: light;
}

/* Тема по умолчанию — светлая (как сайт школы). Тёмная — только по кнопке в шапке. */
:root[data-theme="dark"] {
  --bg: #141416;
  --surface: #1d1d21;
  --surface-2: #232328;
  --text: #f4f3ef;
  --muted: #a19f97;
  --line: #2d2d33;
  --done-bg: #3a3a40;
  --bubble-in: #26262c;
  --accent-soft: #4a2230;
  --shadow: 0 8px 24px rgba(0, 0, 0, .4);
  --today-tint: rgba(247, 223, 87, .06);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body { font: 15px/1.4 var(--font-text); overflow-x: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); caret-color: var(--accent); accent-color: var(--accent); -webkit-user-select: text; user-select: text; }
/* выделение текста: в Telegram на iPhone системный цвет почти не виден на светлом поле */
::selection { background: rgba(255, 105, 142, .35); color: var(--text); }
textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + 90px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 16px 8px; }
.topbar__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar__title { margin: 0; font: 700 34px/1 var(--font-display); text-transform: uppercase; letter-spacing: .5px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }
.role-pill { padding: 7px 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.role-pill small { color: var(--muted); font-weight: 400; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.icon-btn svg { width: 18px; height: 18px; }
/* плавающая кнопка помощника справа внизу, поверх экранов (под шторками) */
.fab { position: fixed; z-index: 35; right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; border: 3px solid var(--surface);
  box-shadow: 0 8px 22px rgba(255, 105, 142, .45), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .15s, bottom .2s; }
.fab:active { transform: scale(.92); }
body.has-composer .fab { bottom: calc(var(--tabbar-h) + 128px + env(safe-area-inset-bottom)); }
.ai-options { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 4px; }
.ai-options button { padding: 9px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent); font-weight: 600; font-size: 14px; text-align: left; }
.ai-options button:active { background: var(--accent); color: #fff; }
/* уведомления бота в ленте помощника (сообщения учеников, подтверждения…) */
.notice { align-self: stretch; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface); font-size: 14px; line-height: 1.4; }
.notice__time { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.notice__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.notice__actions .notice__open { margin-top: 0; }
.notice__open--quiet { border-color: var(--line); color: var(--muted); }
.preview__said { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.reply-chip__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-chip { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 7px 8px 7px 12px; border-radius: var(--r-pill); background: var(--bubble-in); font-size: 13px; }
.reply-chip button { margin-left: auto; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--surface); color: var(--muted); font-size: 13px; }
.notice__open { margin-top: 8px; padding: 7px 12px; border-radius: var(--r-pill); border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; font-size: 13px; }

/* ---------- common ---------- */
.screen { padding: 4px 16px 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.section-title { font: 700 26px/1 var(--font-display); text-transform: uppercase; margin: 22px 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 20px; border-radius: var(--r-pill); font-weight: 600; font-size: 15px; transition: transform .1s; }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--yellow { background: var(--yellow); color: #000; }
.btn--ghost { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn--quiet { background: var(--surface-2); border: 1px solid var(--line); }
.btn--danger { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn--block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .count { opacity: .7; margin-left: 4px; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); }
.seg button { height: 30px; padding: 0 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.is-active { background: var(--text); color: var(--bg); }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; background: var(--yellow); color: #000; white-space: nowrap; }
.badge--pink { background: var(--accent); color: #fff; }
.badge--soft { background: rgba(127,127,127,.16); color: inherit; }
.badge--green { background: var(--regular); color: var(--regular-ink); }
.badge--outline { background: transparent; border: 1px solid currentColor; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot--ok { background: var(--ok); }
.dot--wait { background: var(--wait); }
.dot--off { background: #b9b6ab; }

.card { background: var(--card); color: var(--card-ink); border-radius: var(--r-card); padding: 14px 16px; }
.card + .card { margin-top: 10px; }
/* кнопки на жёлтых карточках всегда светлые — карточка не меняет цвет в тёмной теме */
.card .btn--quiet, .sheet__info .btn--quiet { background: rgba(255, 255, 255, .7); border-color: rgba(0, 0, 0, .12); color: #000; }

.search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 10px; }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; }
.search svg { width: 18px; height: 18px; color: var(--muted); }

/* ---------- schedule ---------- */
.week-nav { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.week-nav__label { font-weight: 600; font-size: 15px; }
.week-nav .icon-btn { width: 32px; height: 32px; }

.teacher-tabs { margin-top: 10px; }

.grid-wrap { margin: 10px -16px 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.grid-wrap::-webkit-scrollbar { display: none; }
.grid { display: grid; grid-template-columns: 40px repeat(7, minmax(47px, 1fr)); min-width: calc(40px + 7 * 47px); padding: 0 4px 0 0; }
.grid__corner, .grid__day { position: sticky; top: 0; z-index: 3; background: var(--bg); }
.grid__corner { left: 0; z-index: 4; }
.grid__day { text-align: center; padding: 6px 2px 8px; font-size: 12px; color: var(--muted); }
.grid__day b { display: grid; place-items: center; width: 30px; height: 30px; margin: 1px auto 0; border-radius: 50%; font-size: 16px; color: var(--text); }
.grid__day.is-today b { background: var(--yellow); color: #000; }
.grid__time { position: sticky; left: 0; z-index: 2; background: var(--bg); font-size: 10.5px; color: var(--muted); text-align: right; padding: 4px 5px 0 0; border-top: 1px solid var(--line); }
.grid__cell { min-height: 50px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lesson--mini { padding: 4px 4px 4px 5px; border-radius: 8px; font-size: 10.5px; line-height: 1.2; }
.lesson--mini .lesson__time { display: block; font-weight: 700; }
.lesson--mini .dot { position: absolute; top: 4px; right: 3px; width: 7px; height: 7px; }
.lesson--mini .lesson__tag { top: -5px; right: -2px; font-size: 8px; padding: 0 4px; }
.lesson--mini .lesson__teacher { position: absolute; bottom: 3px; right: 3px; width: 12px; height: 12px; font-size: 7px; }
.grid__cell.is-today { background: var(--today-tint); }
.grid__cell:empty:active { background: var(--accent-soft); }

.lesson { text-align: left; width: 100%; background: var(--card); color: var(--card-ink); border-radius: 10px; padding: 5px 6px 5px 7px; font-size: 11.5px; line-height: 1.2; position: relative; border: 1.5px solid transparent; }
.lesson b { font-weight: 700; }
.lesson__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson__meta { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 10px; opacity: .75; }
.lesson--regular { background: var(--regular); color: var(--regular-ink); }
.lesson--trial { background: var(--surface); color: var(--text); border: 1.5px dashed var(--accent); }
.lesson--done { opacity: .55; }
.lesson--done .lesson__name { text-decoration: line-through; text-decoration-thickness: 1px; }
.lesson__tag { position: absolute; top: -6px; right: -3px; background: var(--accent); color: #fff; font-size: 8.5px; font-weight: 700; padding: 1px 5px; border-radius: 6px; text-transform: uppercase; letter-spacing: .3px; }
.lesson__teacher { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; font-size: 8px; font-weight: 700; color: #fff; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* day view */
.daystrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.daystrip button { padding: 6px 0; border-radius: 14px; text-align: center; font-size: 12px; color: var(--muted); }
.daystrip button b { display: block; font-size: 17px; color: var(--text); }
.daystrip button.is-active { background: var(--accent); color: #fff; }
.daystrip button.is-active b { color: #fff; }
.daystrip button.is-today:not(.is-active) b { color: var(--accent); }
.dayline { display: grid; grid-template-columns: 46px 1fr; margin-top: 10px; }
.dayline__time { font-size: 12px; color: var(--muted); padding-top: 10px; text-align: right; padding-right: 8px; }
.dayline__slot { border-top: 1px solid var(--line); min-height: 48px; padding: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.dayline__slot .lesson { font-size: 14px; padding: 10px 12px; border-radius: 16px; }
.dayline__slot .lesson__meta { font-size: 12px; }
.dayline__add { height: 36px; border-radius: 12px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 13px; opacity: 0; transition: opacity .15s; }
.dayline__slot:hover .dayline__add, .dayline__add:focus { opacity: 1; }

/* ---------- students ---------- */
.student { display: block; width: 100%; text-align: left; }
.student__top { display: flex; align-items: flex-start; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; background: var(--accent); color: #fff; flex: none; position: relative; }
.avatar--sm { width: 36px; height: 36px; font-size: 14px; }
.avatar__bot { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--card); }
.student__name { font-weight: 700; font-size: 16px; }
.student__nick { font-size: 13px; opacity: .65; }
.student__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.student__balance { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.balance { font-weight: 700; font-size: 15px; }
.balance small { font-weight: 400; opacity: .65; font-size: 12px; display: block; }
.meter { height: 6px; border-radius: 3px; background: rgba(0,0,0,.1); overflow: hidden; margin-top: 4px; width: 110px; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.meter i.low { background: var(--accent); }
.student.is-paused { opacity: .75; }

/* ---------- payments ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); color: var(--card-ink); border-radius: var(--r-card); padding: 14px 16px; }
.stat--pink { background: var(--accent); color: #fff; }
.stat__label { font-size: 12px; opacity: .75; }
.stat__value { font: 700 30px/1.1 var(--font-text); margin-top: 4px; letter-spacing: -.5px; }
.stat__note { font-size: 12px; opacity: .75; margin-top: 2px; }
.pay-row { display: flex; align-items: center; gap: 12px; }
.pay-row__main { flex: 1; min-width: 0; }
.pay-row__main b { display: block; }
.pay-row__main span { font-size: 13px; opacity: .7; }
.pay-main { margin-top: 14px; height: 52px; font-size: 16px; }
.pay-card { display: flex; flex-direction: column; gap: 10px; }
.pay-card.is-due { border-color: var(--accent); }
.pay-card__top { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.pay-card__balance { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }
.pay-card__balance.is-due { color: var(--accent); }
.pay-card__bottom { display: flex; align-items: center; gap: 8px; }
.pay-card__last { flex: 1; min-width: 0; font-size: 12px; opacity: .65; }
.teacher-week { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 14px; align-items: center; }
.teacher-week b { font-weight: 700; }
.teacher-week .num { text-align: right; font-variant-numeric: tabular-nums; }
.teacher-week .head { font-size: 12px; opacity: .65; }
.teacher-week--4 { grid-template-columns: 1fr auto auto auto; }
/* строка преподавателя — кнопка на всю ширину сетки, внутри та же сетка */
.teacher-week__row { display: contents; text-align: left; cursor: pointer; }
.teacher-week__row b { color: var(--accent); }
/* подробно по преподавателю */
.tw-title { margin: 14px 2px 6px; font-size: 15px; }
.tw-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tw-row__main { font-size: 14px; }
.tw-row__main small { display: block; font-size: 12px; opacity: .7; margin-top: 2px; }
.tw-row__acts { display: flex; flex-wrap: wrap; gap: 6px; }
.search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- chats ---------- */
.chat-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.chat-item__main { flex: 1; min-width: 0; }
.chat-item__name { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.chat-item__last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item__side { text-align: right; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.unread { min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }

.thread { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 140px; }
.thread__day { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: var(--r-pill); margin: 6px 0; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 18px; font-size: 14.5px; line-height: 1.35; position: relative; word-wrap: break-word; }
.msg__who { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; opacity: .8; }
.msg__time { font-size: 11px; opacity: .55; margin-left: 8px; float: right; margin-top: 6px; }
.msg--in { align-self: flex-start; background: var(--bubble-in); border-bottom-left-radius: 6px; }
.msg--out { align-self: flex-end; background: var(--card); color: var(--card-ink); border-bottom-right-radius: 6px; }
.msg--teacher { background: var(--regular); color: var(--regular-ink); }
.msg--bot { align-self: flex-end; background: var(--surface); border: 1px solid var(--line); border-bottom-right-radius: 6px; }
.msg__buttons { display: flex; gap: 6px; margin-top: 8px; }
.msg__buttons span { flex: 1; text-align: center; font-size: 12.5px; padding: 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.msg__buttons span.is-picked { background: var(--accent); color: #fff; border-color: var(--accent); }
.msg--event { align-self: center; background: none; color: var(--muted); font-size: 12.5px; padding: 2px 8px; text-align: center; max-width: 92%; }
.file { display: flex; align-items: center; gap: 10px; text-align: left; }
button.file .file__size { color: var(--accent); }
/* фото из переписки: миниатюра, по нажатию — просмотр */
.file-thumb { display: block; max-width: 220px; border-radius: 12px; overflow: hidden; background: var(--surface-2); min-height: 80px; }
.file-thumb img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.file-thumb.is-broken { min-height: 0; }
.file-thumb.is-broken::after { content: "📎 Фото — открыть"; display: block; padding: 10px 12px; color: var(--accent); font-size: 13px; }
.file-view { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: var(--surface-2); }
.file-view--pdf { height: 70vh; border: 0; }
a.btn { text-decoration: none; color: inherit; }
.remind-text { width: 100%; resize: vertical; border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 10px 12px; line-height: 1.35; }
.file__icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.file__name { font-weight: 600; font-size: 13.5px; }
.file__size { font-size: 12px; opacity: .6; }
.ai-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--accent); margin-top: 4px; }

.composer { position: fixed; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 12px 10px; border-top: 1px solid var(--line); z-index: 15; }
.composer__row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); background: var(--surface-2); border-radius: 22px; padding: 11px 16px; max-height: 120px; outline: none; line-height: 1.3; }
.composer textarea:focus { border-color: var(--accent); }
.composer .icon-btn { width: 44px; height: 44px; flex: none; }
.composer .icon-btn--mic { color: var(--accent); border-color: var(--accent); }
.composer .icon-btn--mic svg { width: 22px; height: 22px; }
.composer__send { display: flex; gap: 8px; margin-top: 8px; }
.composer__send .btn { flex: 1; height: 40px; }
.composer__hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; text-align: center; }

.preview { align-self: stretch; border: 2px solid var(--accent); background: var(--surface); border-radius: 18px; padding: 12px 14px; }
.preview__label { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.preview__text { font-size: 14.5px; }
.preview__actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.preview__actions .btn { flex: 1; min-width: 90px; }

.thread-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.thread-head__name { font-weight: 700; font-size: 16px; }
.thread-head__sub { font-size: 12px; color: var(--muted); }

/* ---------- assistant ---------- */
.assistant { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 150px; }
.ai-confirm { align-self: flex-start; width: 92%; background: var(--card); color: var(--card-ink); border-radius: 20px; border-bottom-left-radius: 6px; padding: 14px 16px; }
.ai-confirm__title { font: 700 22px/1 var(--font-display); text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.ai-confirm ul { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; }
.ai-confirm__actions { display: flex; gap: 8px; margin-top: 12px; }
.ai-confirm__actions .btn { flex: 1; }
.ai-confirm.is-resolved .ai-confirm__actions { display: none; }
.voice-tag { display: flex; align-items: center; gap: 4px; font-size: 11px; opacity: .7; margin-bottom: 2px; }
.voice-tag svg { width: 12px; height: 12px; }
.suggests { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
.suggests::-webkit-scrollbar { display: none; }
.suggests button { flex: none; font-size: 12.5px; padding: 7px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); }

.recorder { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); display: none; align-items: flex-end; justify-content: center; }
.recorder.is-open { display: flex; }
.recorder__panel { width: 100%; max-width: 480px; background: var(--bg); border-radius: 28px 28px 0 0; padding: 28px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.recorder__title { font: 700 30px/1 var(--font-display); text-transform: uppercase; }
.recorder__text { min-height: 44px; margin: 12px 0 18px; font-size: 16px; color: var(--muted); }
.wave { display: flex; justify-content: center; align-items: center; gap: 4px; height: 48px; margin: 10px 0; }
.wave i { width: 5px; border-radius: 3px; background: var(--accent); animation: wave 0.9s ease-in-out infinite; }
@keyframes wave { 0%, 100% { height: 8px; } 50% { height: 42px; } }
.recorder__mic { width: 84px; height: 84px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-grid; place-items: center; box-shadow: 0 0 0 0 rgba(255,105,142,.5); animation: pulse 1.4s infinite; }
.recorder__mic svg { width: 36px; height: 36px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,105,142,.55); } 70% { box-shadow: 0 0 0 22px rgba(255,105,142,0); } 100% { box-shadow: 0 0 0 0 rgba(255,105,142,0); } }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; }
.tab { height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--accent); }
.tab .unread { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; }
.tab--mic { justify-content: flex-start; }
.tab--mic .mic { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 8px 20px rgba(255,105,142,.45); border: 4px solid var(--surface); }
.tab--mic .mic svg { width: 30px; height: 30px; }
.tab--mic span { margin-top: 2px; }
.tab--mic.is-active > span:last-child { color: var(--accent); }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 480px; transform: translate(-50%, 105%); transition: transform .25s cubic-bezier(.2,.8,.2,1); z-index: 50; background: var(--bg); border-radius: 28px 28px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.sheet.is-open { transform: translate(-50%, 0); }
.sheet__handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font: 700 30px/1 var(--font-display); text-transform: uppercase; }
.sheet__sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.sheet__info { background: var(--card); color: var(--card-ink); border-radius: var(--r-card); padding: 4px 16px; margin-bottom: 14px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,.08); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { opacity: .65; }
.select-search { width: 100%; margin-bottom: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.kv--btn { width: 100%; text-align: left; cursor: pointer; }
.thread__card { margin-top: 6px; }
.kv span:last-child { text-align: right; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sheet__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet__actions .btn--block { grid-column: 1 / -1; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.slot { height: 52px; border-radius: 16px; background: var(--surface-2); border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.slot small { font-weight: 400; color: var(--muted); font-size: 12px; }
.slot.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 4px 4px; }
.field input, .field select { display: block; width: 100%; min-width: 0; max-width: 100%; height: 46px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px; outline: none; }
/* iOS рисует поля даты/времени со своей минимальной шириной — из-за неё они наезжали друг на друга */
.field input[type="time"], .field input[type="date"] { -webkit-appearance: none; appearance: none; line-height: 46px; text-align: left; }
.field input::-webkit-date-and-time-value { text-align: left; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.field-row > * { min-width: 0; }
.field span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.color-dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 0 0 1.5px var(--line); }
.color-dot.is-picked { box-shadow: 0 0 0 2.5px var(--text); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 14px; font-size: 14px; }
.toggle-row small { display: block; font-size: 12px; opacity: .65; margin-top: 2px; }
.switch { flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.is-on { background: var(--ok); }
.switch.is-on::after { transform: translateX(18px); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #111; color: #fff; padding: 11px 18px; border-radius: var(--r-pill); font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 70; max-width: calc(100% - 32px); text-align: center; }
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
