/* Rovitek — стиль WhatsApp для iPhone (поверх app.css): крупные заголовки, «стеклянные» кнопки,
   плавающее нижнее меню, пузыри с хвостиком внизу, галочки доставки/прочтения. */
:root {
  --green: #25d366;
  --green-btn: #21c063;
  --green-dark: #1daa61;
  --green-soft: #d9fdd3;
  --green-soft-line: #9fe3ab;
  --green-soft-text: #15603e;
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #000000;
  --text-2: #8a8a8e;
  --text-3: #a0a0a5;
  --line: #e3e3e6;
  --hover: #f2f2f4;
  --search: #f0f0f2;
  --chip-line: #d6d6da;
  --chat-bg: #f5f1eb;
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --bubble-shadow: 0 0.5px 1px rgba(0, 0, 0, .12);
  --meta: #8a9a8c;
  --meta-in: #8e8e93;
  --tick: #8e8e93;
  --tick-read: #34b7f1;
  --glass: rgba(255, 255, 255, .78);
  --glass-line: rgba(0, 0, 0, .06);
  --glass-shadow: 0 4px 18px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .06);
  --date-bg: rgba(255, 255, 255, .92);
  --icon: #000000;
  --icon-2: #3c3c43;
  --sys-bg: #fff6d6;
  --sys-text: #6b6150;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green: #25d366;
    --green-btn: #21c063;
    --green-soft: #103529;
    --green-soft-line: #1e6b4b;
    --green-soft-text: #d8fdd2;
    --bg: #000000;
    --panel: #000000;
    --text: #ffffff;
    --text-2: #8e8e93;
    --text-3: #6e6e73;
    --line: #2c2c2e;
    --hover: #1c1c1e;
    --search: #1c1c1e;
    --chip-line: #3a3a3c;
    --chat-bg: #0b0b0b;
    --bubble-out: #144d37;
    --bubble-in: #262628;
    --meta: rgba(255, 255, 255, .55);
    --meta-in: rgba(255, 255, 255, .5);
    --tick: rgba(255, 255, 255, .55);
    --tick-read: #53bdeb;
    --glass: rgba(40, 40, 42, .78);
    --glass-line: rgba(255, 255, 255, .08);
    --glass-shadow: 0 4px 18px rgba(0, 0, 0, .4);
    --date-bg: rgba(38, 38, 40, .92);
    --icon: #ffffff;
    --icon-2: #ebebf5;
    --sys-bg: #262628;
    --sys-text: #ffd279;
  }
}

body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; letter-spacing: -0.1px; }

/* ---------- «стекло» ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--glass-line);
  box-shadow: var(--glass-shadow);
}
.gbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--icon); flex: none; }
.gbtn svg.i { width: 24px; height: 24px; }
.gbtn:active { transform: scale(.94); }
.plus-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--green-btn); color: #fff; flex: none; box-shadow: 0 4px 14px rgba(33, 192, 99, .35); }
.plus-btn svg.i { width: 28px; height: 28px; }
.plus-btn:active { transform: scale(.94); }

/* ---------- шапка списков ---------- */
.ios-top { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 10px) 16px 2px; }
.ios-top .sp { flex: 1; }
.large-title { flex: none; font-size: 34px; font-weight: 700; letter-spacing: .3px; padding: 6px 16px 8px; }
.search { margin: 4px 16px 10px; height: 40px; border-radius: 20px; background: var(--search); padding: 0 14px; gap: 8px; color: var(--text-2); }
.search svg.i { width: 20px; height: 20px; }
.search input { font-size: 17px; }
.chips { padding: 2px 16px 10px; gap: 8px; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; background: transparent; border: 1px solid var(--chip-line); color: var(--text-2); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.chip.on { background: var(--green-soft); border-color: var(--green-soft-line); color: var(--green-soft-text); font-weight: 600; }
.chip .cn { font-weight: 500; }

/* ---------- строки ---------- */
.row { gap: 12px; padding: 0 0 0 16px; min-height: 78px; }
.row .body { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 10px 16px 10px 0; border-bottom: 0.5px solid var(--line); min-height: 78px; }
.row:last-child .body { border-bottom-color: transparent; }
.row .name { font-size: 17px; font-weight: 600; }
.row .time { font-size: 15px; color: var(--text-2); }
.row .time.unread { color: var(--green-dark); font-weight: 400; }
.row .line2 { align-items: flex-start; }
.row .prev { font-size: 15px; line-height: 20px; color: var(--text-2); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.row .prev svg.i { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; margin-right: 2px; }
.row .prev .who { color: var(--text); }
.row .prev .typing { color: var(--green-dark); }
.row .sub { font-size: 15px; }
.badge { min-width: 22px; height: 22px; border-radius: 11px; background: var(--green); color: #fff; font-size: 13px; font-weight: 600; margin-top: 4px; }
@media (prefers-color-scheme: dark) { .badge { color: #000; } }
.row .muted-ic { color: var(--text-3); margin-top: 5px; }
.row .muted-ic svg.i { width: 17px; height: 17px; }
.ava { width: 54px; height: 54px; }
.ava.def { background: #d9dfe3; color: #fff; }
@media (prefers-color-scheme: dark) { .ava.def { background: #3a3a3c; color: #8e8e93; } }
.ava-wrap .dot { border-color: var(--bg); background: var(--green); }
.section-title { font-size: 15px; color: var(--text-2); font-weight: 400; padding: 18px 16px 6px; text-transform: none; }
.row.lead .ava { background: var(--green-soft); color: var(--green-dark); }
.row:active { background: var(--hover); }
.row.sel { background: var(--hover); }

/* галочки */
svg.ticks { width: 17px; height: 11px; flex: none; display: inline-block; fill: none; stroke: var(--tick); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
svg.ticks.read { stroke: var(--tick-read); }
.row .prev svg.ticks { width: 17px; height: 11px; vertical-align: 0; margin-right: 3px; }

/* ---------- плавающее нижнее меню ---------- */
.fab { display: none; }
.tabbar {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 6px); z-index: 5;
  border-top: 0; border-radius: 34px; padding: 6px; display: flex; gap: 2px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--glass-line); box-shadow: var(--glass-shadow);
}
.tab { flex: 1; border-radius: 28px; padding: 6px 0 5px; gap: 2px; font-size: 11px; font-weight: 500; color: var(--icon); }
.tab .pill { width: auto; height: 30px; background: none !important; color: inherit !important; }
.tab .pill svg.i { width: 27px; height: 27px; }
.tab.on { background: rgba(120, 120, 128, .16); font-weight: 600; }
.tab .tbadge { left: auto; right: -12px; top: -4px; background: var(--green); min-width: 20px; height: 20px; font-size: 12px; border: 2px solid var(--glass); }
.tab .me-ava { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: #d9dfe3; display: grid; place-items: center; color: #fff; }
.tab .me-ava img { width: 100%; height: 100%; object-fit: cover; }
.tab .me-ava svg.i { width: 20px; height: 20px; }
.scroll.has-tabbar::after { content: ""; display: block; height: calc(var(--safe-bottom) + 96px); }

/* ---------- страницы (новый чат, профиль и т.п.) ---------- */
.page-head { gap: 4px; padding: calc(var(--safe-top) + 8px) 12px 8px; min-height: calc(var(--safe-top) + 60px); }
.page-head .t { font-size: 17px; font-weight: 600; text-align: center; }
.page-head .t small { font-size: 13px; }
.page-head .icon-btn { color: var(--icon); }
.item .ic { color: var(--icon-2); }
.item .tx .a { font-size: 17px; }
.item { border-bottom: 0.5px solid var(--line); margin-left: 16px; padding-left: 0; gap: 16px; }
.gap { height: 22px; background: transparent; border: 0; }
@media (prefers-color-scheme: dark) { .gap { background: transparent; } }
.btn { background: var(--green-btn); border-radius: 25px; }
.switch { width: 51px; height: 31px; border-radius: 16px; background: #e9e9eb; }
.switch::after { width: 27px; height: 27px; top: 2px; left: 2px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.switch.on { background: #34c759; }
.switch.on::after { transform: translateX(20px); }
@media (prefers-color-scheme: dark) { .switch { background: #39393d; } }

/* ---------- экран чата ---------- */
.chat { background: var(--chat-bg); }
.chat::before { opacity: 1; }
.chat-head {
  position: absolute; left: 0; right: 0; top: 0; z-index: 4; border: 0; background: none;
  padding: calc(var(--safe-top) + 6px) 12px 14px; gap: 8px; min-height: 0;
}
.chat-head::before { content: ""; position: absolute; inset: 0 0 -26px; z-index: -1;
  background: linear-gradient(to bottom, var(--chat-bg) 0%, var(--chat-bg) calc(100% - 26px), transparent 100%);
  pointer-events: none; }
.back-pill { height: 44px; min-width: 44px; padding: 0 12px 0 8px; border-radius: 22px; display: flex; align-items: center; gap: 2px; color: var(--icon); font-size: 17px; flex: none; }
.back-pill svg.i { width: 26px; height: 26px; }
.back-pill.only { padding: 0; justify-content: center; }
.chat-head .who { gap: 10px; padding: 0; }
.chat-head .who .ava { width: 44px; height: 44px; }
.chat-head .who .n { font-size: 17px; font-weight: 600; }
.chat-head .who .s { font-size: 13px; color: var(--text-2); }
.chat-head .who .s.on { color: var(--text-2); }
.call-pill { height: 44px; border-radius: 22px; display: flex; align-items: center; padding: 0 4px; flex: none; }
.call-pill button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--icon); }
.call-pill button svg.i { width: 24px; height: 24px; }
.msgs { padding-top: calc(var(--safe-top) + 76px); }
.conn { position: absolute; top: calc(var(--safe-top) + 66px); left: 50%; transform: translateX(-50%); z-index: 5; border-radius: 14px; padding: 4px 12px; }

.day { background: var(--date-bg); color: var(--text); font-size: 13px; font-weight: 500; border-radius: 12px; padding: 5px 12px; box-shadow: 0 0.5px 1px rgba(0,0,0,.08); top: calc(var(--safe-top) + 68px); }
.sys { border-radius: 12px; font-size: 13px; }

/* пузыри: скругление как в iOS, хвостик у последнего в серии — снизу */
.m { padding: 0 12px; margin-top: 2px; }
.m.first { margin-top: 8px; }
.bubble { border-radius: 18px; padding: 6px 10px 7px 12px; font-size: 17px; line-height: 22px; box-shadow: var(--bubble-shadow); max-width: min(80%, 560px); }
.m.first .bubble, .m.out.first .bubble { border-radius: 18px; }
.m.first .bubble::before, .m.out.first .bubble::before { display: none; }
.m.last .bubble { border-bottom-left-radius: 4px; }
.m.out.last .bubble { border-bottom-left-radius: 18px; border-bottom-right-radius: 4px; }
.m.last .bubble::after {
  content: ""; position: absolute; bottom: 0; left: -6px; width: 12px; height: 14px; background: inherit;
  clip-path: path('M12 0 L12 14 L0 14 C 5 12, 7 8, 7 0 Z');
}
.m.out.last .bubble::after { left: auto; right: -6px; clip-path: path('M0 0 L0 14 L12 14 C 7 12, 5 8, 5 0 Z'); }
.m.last { margin-bottom: 4px; }
.bubble .meta { font-size: 12px; color: var(--meta-in); bottom: 4px; right: 10px; gap: 3px; }
.m.out .bubble .meta { color: var(--meta); }
.bubble .meta-pad { width: 50px; }
.m.out .bubble .meta-pad { width: 70px; }
.bubble.edited .meta-pad { width: 116px; }
.m.out .bubble.edited .meta-pad { width: 136px; }
.bubble .txt.big { font-size: 46px; line-height: 1.15; }
.bubble.media { padding: 4px; border-radius: 18px; }
.bubble.media .photo { border-radius: 14px; }
.bubble .author { font-size: 14px; }
.quote { border-radius: 10px; }
.quote .qt { font-size: 14px; }
.bubble.media .meta.on-media { color: #fff; right: 12px; bottom: 9px; }
.bubble.media .meta.on-media svg.ticks:not(.read) { stroke: #fff; }

/* сообщение о звонке (как на iPhone) */
.callmsg { gap: 12px; min-width: 200px; padding: 4px 6px 10px 0; }
.callmsg .ci { width: 44px; height: 44px; background: rgba(120, 120, 128, .14); color: var(--icon); }
.callmsg .ci.miss { color: #ff3b30; }
.callmsg .ct { font-size: 17px; font-weight: 600; }
.callmsg .cs { font-size: 15px; color: var(--text-2); }

/* поле ввода */
.composer { padding: 6px 8px calc(var(--safe-bottom) + 8px); gap: 6px; align-items: flex-end; background: linear-gradient(transparent, var(--chat-bg) 30%); }
.composer .plain-btn { width: 40px; height: 44px; display: grid; place-items: center; color: var(--icon); flex: none; }
.composer .plain-btn svg.i { width: 28px; height: 28px; }
.composer .field { border-radius: 22px; box-shadow: 0 0 0 0.5px var(--chip-line); background: var(--input-bg); }
.composer .field .row-in { min-height: 40px; }
.composer textarea { font-size: 17px; padding: 9px 4px 9px 14px; line-height: 22px; }
.composer .field .icon-btn { width: 40px; height: 40px; color: var(--icon-2); }
.send-btn { width: 44px; height: 44px; background: var(--green-btn); box-shadow: none; }
.send-btn svg.i { width: 24px; height: 24px; }
@media (prefers-color-scheme: dark) { .send-btn { color: #fff; } .composer .field { background: #1c1c1e; } }
.to-bottom { bottom: calc(var(--safe-bottom) + 80px); border-radius: 50%; }
.recbar { height: 44px; border-radius: 22px; }

/* профиль/инфо */
.profile-top h2 { font-size: 26px; font-weight: 700; }
.actions button { border: 0; background: var(--search); border-radius: 14px; color: var(--green-dark); font-weight: 500; }

/* широкий экран (компьютер): обычная шапка, меню снизу внутри колонки */
@media (min-width: 900px) {
  .tabbar { left: 10px; right: 10px; }
}
