/* Оформление в духе Apple (apple.com, iOS 18): системный шрифт SF Pro, много воздуха, сгруппированные списки,
   «стекло» у панелей, синий акцент. Тёмная тема — по системной настройке. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --fill: rgba(120, 120, 128, .12);       /* серые заливки кнопок и полей, как в iOS */
  --fill-2: rgba(120, 120, 128, .2);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --tertiary: #aeaeb2;
  --line: rgba(60, 60, 67, .14);
  --accent: #0071e3;
  --accent-2: #5e5ce6;
  --accent-soft: rgba(0, 113, 227, .1);
  --ok: #34c759;
  --warn: #ff9500;
  --danger: #ff3b30;
  --user-bubble: #0b84ff;
  --user-text: #ffffff;
  --bot-bubble: #e9e9eb;
  --glass: rgba(250, 250, 252, .72);
  --shadow: 0 1px 1px rgba(0, 0, 0, .02), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .06);
  --radius: 18px;
  --radius-s: 12px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --tabbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .32);
    --text: #f5f5f7;
    --muted: #98989d;
    --tertiary: #636366;
    --line: rgba(84, 84, 88, .55);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, .18);
    --ok: #30d158;
    --warn: #ff9f0a;
    --danger: #ff453a;
    --user-bubble: #0a84ff;
    --bot-bubble: #26252a;
    --glass: rgba(28, 28, 30, .72);
    --shadow: none;
    --shadow-float: 0 12px 40px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.022em;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:active { opacity: .7; }
[hidden] { display: none !important; }
svg.i { width: 1em; height: 1em; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---------- каркас ---------- */
#app { display: flex; flex-direction: column; height: 100dvh; height: 100vh; height: 100dvh; }
.topbar {
  padding: calc(var(--safe-top) + 14px) 20px 10px;
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 34px; line-height: 1.12; margin: 0; flex: 1; font-weight: 700; letter-spacing: -.025em; min-width: 0; }
.topbar .sub { color: var(--muted); font-size: 15px; font-weight: 400; letter-spacing: -.01em; margin-top: 2px; }
.icon-btn {
  border: 0; background: var(--fill); width: 36px; height: 36px; border-radius: 50%; color: var(--accent);
  display: inline-grid; place-items: center; font-size: 19px; flex: none; margin-bottom: 4px;
}
.icon-btn.primary { background: var(--accent); color: #fff; }
.icon-btn.text { width: auto; padding: 0 14px; border-radius: 980px; font-size: 15px; font-weight: 600; }
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px); }
.view > .topbar { margin: -4px -16px 6px; }
/* чат — компактная «стеклянная» шапка, как в «Сообщениях» */
.view.chat-view { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.view.chat-view > .topbar {
  margin: 0; align-items: center; padding: calc(var(--safe-top) + 8px) 16px 8px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--line);
}
.view.chat-view > .topbar h1 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.view.chat-view > .topbar .sub { font-size: 12px; }
.view.chat-view > .topbar .icon-btn { margin: 0; width: 34px; height: 34px; font-size: 18px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line);
}
.tabbar button {
  border: 0; background: none; color: var(--tertiary); font-size: 10.5px; font-weight: 500; letter-spacing: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; position: relative;
}
.tabbar button .ic { font-size: 25px; line-height: 1; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active svg.i { stroke-width: 2.1; }
.tabbar .badge {
  position: absolute; top: 4px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; line-height: 18px;
}

/* ---------- карточки и списки (inset grouped) ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.section-title {
  font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text);
  margin: 26px 2px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.section-title button { border: 0; background: none; color: var(--accent); font-weight: 400; font-size: 17px; letter-spacing: -.02em; padding: 0; }
.list { background: var(--surface); border-radius: var(--radius-s); box-shadow: var(--shadow); overflow: hidden; }
.item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; min-height: 48px; position: relative;
  background: none; border: 0; width: 100%; text-align: left;
}
/* разделитель с отступом слева, как в iOS */
.item + .item::before { content: ""; position: absolute; top: 0; right: 0; left: 52px; border-top: .5px solid var(--line); }
.item .time { min-width: 50px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); font-size: 15px; padding-top: 1px; white-space: pre-line; line-height: 1.25; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 400; word-wrap: break-word; }
.item .meta, .meta { color: var(--muted); font-size: 13px; letter-spacing: -.005em; margin-top: 2px; line-height: 1.38; }
/* круглая галочка как в «Напоминаниях» */
.item .check {
  width: 24px; height: 24px; border-radius: 50%; border: 1.6px solid var(--tertiary); flex: none; margin-top: 1px;
  display: grid; place-items: center; background: none; padding: 0; font-size: 13px; font-weight: 700; color: #fff;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.item .check.done { background: var(--accent); border-color: var(--accent); }
/* выполненное не исчезает: серым и зачёркнутым */
.item.is-done .title, .note-card.is-done .title { text-decoration: line-through; text-decoration-color: var(--tertiary); color: var(--muted); }
.item.is-done .time, .item.is-done .meta { color: var(--tertiary); }
.item.is-done .pill { opacity: .6; }
.item .tag, .tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 980px; background: var(--accent-soft); color: var(--accent); margin: 4px 4px 0 0; letter-spacing: 0; }
.item .side { margin-left: auto; align-self: center; flex: none; }
.empty { color: var(--muted); text-align: center; padding: 26px 16px; font-size: 15px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 980px; background: var(--fill); color: var(--muted); letter-spacing: 0; }
.pill.alarm { background: rgba(255, 59, 48, .12); color: var(--danger); }
.pill.overdue { background: rgba(255, 149, 0, .14); color: var(--warn); }
.pill.done { background: rgba(52, 199, 89, .14); color: var(--ok); }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 15px; padding: 6px 0; }
.disclosure { border: 0; background: none; color: var(--accent); font-size: 15px; padding: 10px 2px; display: flex; align-items: center; gap: 6px; }

/* ---------- чат ---------- */
.messages { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 82%; padding: 8px 14px; border-radius: 20px; word-wrap: break-word; animation: pop .3s var(--ease); font-size: 17px; line-height: 1.38; }
.msg.user { align-self: flex-end; background: var(--user-bubble); color: var(--user-text); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--bot-bubble); border-bottom-left-radius: 6px; }
.msg.error { background: rgba(255, 59, 48, .12); color: var(--danger); }
.msg .voice-mark { font-size: 12px; opacity: .8; margin-right: 4px; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 6px; padding-left: 20px; }
.msg code { background: var(--fill); padding: 1px 5px; border-radius: 6px; font-size: 15px; }
.msg-tools { display: flex; gap: 6px; margin-top: 6px; }
.msg-tools button { border: 0; background: var(--fill); border-radius: 980px; padding: 3px 10px; font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 5px 11px; border-radius: 980px;
  background: var(--surface); color: var(--accent); font-weight: 500; border: 0; text-align: left; letter-spacing: -.005em;
}
.chip.deleted { color: var(--muted); }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.tool-status { font-size: 13px; color: var(--muted); margin-top: 4px; }
.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px;
  margin-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; border: .5px solid var(--line); background: var(--surface); border-radius: 20px;
  padding: 8px 14px; max-height: 140px; min-height: 38px; font-size: 17px; line-height: 1.3; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.round { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 20px; flex: none; background: var(--fill); color: var(--accent); }
.round.send { background: var(--accent); color: #fff; }
.round.rec { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
.round.talk { background: linear-gradient(135deg, #0a84ff, #5e5ce6 55%, #bf5af2); color: #fff; }
.suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions button { flex: none; border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 980px; padding: 7px 14px; font-size: 15px; color: var(--accent); }

/* ---------- календарь ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.cal-head h2::first-letter { text-transform: uppercase; }
.cal-head .icon-btn { margin: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: 12px; color: var(--muted); font-weight: 500; padding: 4px 0; text-transform: uppercase; }
.cal-day {
  border: 0; background: none; aspect-ratio: 1; border-radius: 50%; font-size: 18px; font-weight: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0;
  font-variant-numeric: tabular-nums; max-width: 48px; margin: 0 auto; width: 100%;
}
.cal-day.other { color: var(--tertiary); }
.cal-day.today { color: var(--danger); font-weight: 600; }
.cal-day.selected { background: var(--text); color: var(--bg); font-weight: 600; }
.cal-day.today.selected { background: var(--danger); color: #fff; }
.cal-day .dots { display: flex; gap: 2px; height: 4px; }
.cal-day .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-day .dots i.r { background: var(--warn); } .cal-day .dots i.t { background: var(--ok); }
.cal-day.selected .dots i { background: currentColor; }

/* ---------- заметки ---------- */
.search {
  width: 100%; border: 0; background: var(--fill); border-radius: 10px; padding: 8px 12px 8px 34px; font-size: 17px; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 17px; background-position: 10px center;
}
/* segmented control в стиле iOS: серая дорожка, белый «бегунок» */
.segmented {
  display: flex; gap: 2px; margin: 12px 0; padding: 2px; overflow-x: auto; scrollbar-width: none;
  background: var(--fill); border-radius: 9px;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  border: 0; background: none; border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 500; flex: 1 0 auto;
  white-space: nowrap; letter-spacing: -.01em; transition: background .2s var(--ease);
}
.segmented button.active { background: var(--surface); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); font-weight: 600; color: var(--text); }
@media (prefers-color-scheme: dark) { .segmented button.active { background: #636366; } }
.note-card { display: block; width: 100%; text-align: left; border: 0; }
.note-card .title { font-weight: 600; font-size: 17px; }
.note-card .preview { color: var(--muted); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; white-space: pre-line; line-height: 1.4; }
.note-card.is-done { opacity: .62; }
.note-card .meta { margin-top: 8px; }

/* ---------- формы и шторка ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 50; animation: fade .3s var(--ease); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--surface);
  border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 6px 20px calc(var(--safe-bottom) + 20px); animation: up .45s var(--ease); box-shadow: var(--shadow-float);
}
@media (prefers-color-scheme: light) { .sheet { background: var(--bg); } .sheet .field input, .sheet .field select, .sheet .field textarea { background: var(--surface); } }
@media (min-width: 700px) { .sheet { left: 50%; width: 560px; transform: translateX(-50%); bottom: 24px; border-radius: 20px; } }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 4px auto 14px; }
.sheet h3 { margin: 0 0 16px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin: 0 4px 6px; letter-spacing: -.005em; }
.field input, .field select, .field textarea {
  width: 100%; border: 0; background: var(--fill); border-radius: 10px; padding: 11px 12px;
  font-size: 17px; outline: none; min-height: 44px; -webkit-appearance: none; appearance: none;
}
.field select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4-4 4 4M8 14l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: right 10px center;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.row { display: flex; gap: 10px; } .row > * { flex: 1; min-width: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; min-height: 44px; }
.switch input { width: 51px; height: 31px; appearance: none; -webkit-appearance: none; background: var(--fill-2); border-radius: 16px; position: relative; transition: background .25s var(--ease); flex: none; border: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06); transition: left .25s var(--ease); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 22px; }
/* кнопки-капсулы */
.btn { border: 0; border-radius: 980px; padding: 11px 20px; font-weight: 500; font-size: 17px; background: var(--accent-soft); color: var(--accent); min-height: 44px; letter-spacing: -.02em; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: rgba(255, 59, 48, .1); color: var(--danger); }
.btn.primary.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 30px; padding: 4px 12px; font-size: 14px; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---------- вход ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 340px; text-align: center; }
.login .logo { width: 88px; height: 88px; border-radius: 20px; margin-bottom: 18px; box-shadow: var(--shadow-float); }
.login h1 { margin: 0 0 6px; font-size: 34px; letter-spacing: -.025em; } .login p { color: var(--muted); margin: 0 0 24px; }
.error-text { color: var(--danger); font-size: 14px; min-height: 20px; margin: 8px 0; }

/* ---------- уведомления/подсказки ---------- */
.banner { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: var(--accent-soft); font-size: 15px; }
.banner b { display: block; margin-bottom: 4px; }
.banner ol { margin: 6px 0 8px; padding-left: 20px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 72px);
  background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--text);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding: 11px 18px; border-radius: 22px; z-index: 100; box-shadow: var(--shadow-float); width: max-content; max-width: min(92vw, 520px); line-height: 1.35;
  font-size: 15px; max-width: 92vw; animation: toast .35s var(--ease); display: flex; align-items: center; gap: 14px;
}
.toast button { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 15px; padding: 0; white-space: nowrap; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--tertiary); vertical-align: middle; }
.status-dot.ok { background: var(--ok); } .status-dot.bad { background: var(--danger); } .status-dot.wait { background: var(--warn); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; font-size: 15px; border-bottom: .5px solid var(--line); }
.kv:last-child { border-bottom: 0; } .kv span:last-child { color: var(--muted); text-align: right; word-break: break-word; }
.kv .btn { min-height: 30px; padding: 4px 12px; font-size: 14px; flex: none; }

/* ---------- голосовой режим (в духе Siri) ---------- */
.voice-overlay {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: calc(var(--safe-top) + 18px) 20px calc(var(--safe-bottom) + 28px);
  background: radial-gradient(110% 70% at 50% 35%, #15172b 0%, #000 72%); color: #fff; animation: fade .3s var(--ease);
  transition: filter .8s ease;
}
.voice-overlay .v-top { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; }
.voice-overlay .v-top .icon-btn { background: rgba(255,255,255,.12); color: #fff; }
.voice-status { font-size: 15px; opacity: .75; font-weight: 500; }
.orb {
  width: 180px; height: 180px; border-radius: 50%; border: 0; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 42%),
    conic-gradient(from 210deg, #0a84ff, #5e5ce6, #bf5af2, #ff375f, #ff9f0a, #64d2ff, #0a84ff);
  box-shadow: 0 0 70px rgba(94, 92, 230, .55), inset 0 0 40px rgba(255,255,255,.18);
  transition: transform .12s ease-out; filter: saturate(1.1);
}
.orb.listening, .orb.standby { animation: hue 8s linear infinite; transition: transform .08s linear; }
.orb.thinking { animation: spin 1.4s linear infinite; }
.orb.speaking { animation: hue 3s linear infinite; box-shadow: 0 0 110px rgba(191, 90, 242, .7), inset 0 0 40px rgba(255,255,255,.2); }
.voice-texts { width: 100%; max-width: 560px; min-height: 140px; text-align: center; }
.voice-texts .you { opacity: .6; font-size: 16px; margin-bottom: 10px; }
.voice-texts .bot { font-size: 21px; line-height: 1.35; font-weight: 500; letter-spacing: -.02em; max-height: 32vh; overflow-y: auto; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.voice-actions .chip { background: rgba(255,255,255,.14); color: #fff; }
.voice-bottom { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.voice-bottom .btn { background: rgba(255,255,255,.14); color: #fff; min-width: 108px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.voice-bottom .btn.danger { background: var(--danger); color: #fff; }

/* «На связи»: часы, спокойный шар, затемнение экрана через 30 с */
.standby-clock { display: none; font-family: "SF Pro Display", -apple-system, sans-serif; font-size: 84px; font-weight: 200; letter-spacing: -.02em; font-variant-numeric: tabular-nums; opacity: .92; line-height: 1; }
.voice-overlay.standby-mode .standby-clock { display: block; }
.voice-overlay.waiting .orb { width: 110px; height: 110px; opacity: .6; box-shadow: 0 0 36px rgba(94, 92, 230, .35); }
.voice-overlay.dim { filter: brightness(.22); }
.voice-overlay.dim .voice-bottom { visibility: hidden; }

/* просмотр заметки-исследования */
.note-view { font-size: 17px; line-height: 1.5; max-height: 62vh; overflow-y: auto; margin-bottom: 12px; word-break: break-word; }
.note-view .md-h { margin: 18px 0 6px; font-size: 20px; letter-spacing: -.02em; }
.note-view ul, .note-view ol { padding-left: 22px; margin: 4px 0; }
.msg a, .note-view a { color: var(--accent); text-decoration: none; }
.msg.user a { color: #fff; text-decoration: underline; }
.msg a:hover, .note-view a:hover { text-decoration: underline; }

/* ---------- компьютер: боковая панель как в macOS + колонка по центру ---------- */
.tabbar .brand { display: none; }
@media (min-width: 900px) {
  :root { --tabbar-h: 0px; --side: 248px; --col: 780px; --gutter: max(28px, calc((100% - var(--col)) / 2)); }
  #app { padding-left: var(--side); }
  .tabbar {
    top: 0; bottom: 0; right: auto; width: var(--side); height: 100vh; padding: 22px 12px;
    display: flex; flex-direction: column; gap: 2px; border-top: 0; border-right: .5px solid var(--line);
  }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 10px 20px; color: var(--text); letter-spacing: -.02em; }
  .tabbar .brand img { width: 30px; height: 30px; border-radius: 8px; }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 15px; font-weight: 500; padding: 8px 10px; border-radius: 8px; flex: none; color: var(--text); letter-spacing: -.01em; }
  .tabbar button .ic { font-size: 20px; color: var(--accent); }
  .tabbar button:hover { background: var(--fill); }
  .tabbar button.active { background: var(--accent); color: #fff; }
  .tabbar button.active .ic { color: #fff; }
  .tabbar .badge { position: static; margin-left: auto; }
  .tabbar button.active .badge { background: #fff; color: var(--accent); }
  .view { padding: 8px var(--gutter) 40px; }
  .view > .topbar { margin: -8px 0 8px; padding-left: 0; padding-right: 0; padding-top: 30px; }
  .view.chat-view { padding: 0; }
  .view.chat-view > .topbar { padding-left: var(--gutter); padding-right: var(--gutter); padding-top: 14px; }
  .messages { padding-left: var(--gutter); padding-right: var(--gutter); }
  .suggestions { padding-left: var(--gutter); padding-right: var(--gutter); }
  .composer { margin-bottom: 0; padding: 12px var(--gutter) 18px; }
  .msg { max-width: 72%; }
  .toast { left: calc(50% + var(--side) / 2); top: 22px; bottom: auto; }
  .sheet { left: calc(50% + var(--side) / 2); width: 600px; max-height: 86vh; }
}

@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, .5); } 100% { box-shadow: 0 0 0 14px rgba(255, 59, 48, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toast { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes hue { to { filter: saturate(1.1) hue-rotate(360deg); } }
@media (min-width: 700px) { .sheet { animation: fade .25s var(--ease); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- выбор модели ---------- */
.picker { position: relative; }
.picker input { width: 100%; padding-right: 40px; }
.picker-toggle {
  position: absolute; right: 4px; top: 4px; bottom: 4px; width: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 16px;
}
.picker-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: .5px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float);
  padding: 6px; scroll-margin-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
}
.picker-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; }
.picker-item:hover, .picker-item.selected { background: var(--accent-soft); }
.picker-name { font-weight: 600; font-size: 15px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; word-break: break-all; }
.picker-desc { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.picker-tags { font-size: 11px; color: var(--accent); margin-top: 2px; }
.picker-flag { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 980px; background: var(--fill); color: var(--muted); }
@media (max-width: 700px) { .row.stack-mobile { flex-direction: column; gap: 0; } }
.picker-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.picker-more { display: block; width: 100%; border: 0; background: none; color: var(--accent); font-weight: 500; font-size: 14px; padding: 10px; border-top: .5px solid var(--line); margin-top: 4px; }

/* ---------- характер ассистента ---------- */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.persona-card {
  text-align: left; border: 0; background: var(--fill); border-radius: 14px; padding: 12px; min-height: 68px;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s var(--ease), background .2s var(--ease);
}
.persona-card b { display: block; font-size: 15px; font-weight: 600; }
.persona-card span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.3; letter-spacing: 0; }
.persona-card.active { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.persona-example { font-size: 13px; color: var(--muted); font-style: italic; margin: 0 2px 10px; }

/* ---------- корзина ---------- */
.trash-kind { font-size: 12px; color: var(--muted); }

/* ---------- «Ухо»: капсула в шапке ---------- */
.ear-pill {
  display: inline-flex; align-items: center; gap: 7px; flex: none; margin-bottom: 6px;
  border: 0; border-radius: 980px; padding: 5px 11px 5px 9px; font-size: 13px; font-weight: 500; letter-spacing: -.01em;
  background: var(--fill); color: var(--muted); max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ear-pill span { overflow: hidden; text-overflow: ellipsis; }
.ear-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); flex: none; transition: transform .1s linear; }
.ear-pill.s-on { background: rgba(52, 199, 89, .14); color: var(--ok); }
.ear-pill.s-on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 199, 89, .2); }
.ear-pill.s-need-tap, .ear-pill.s-error { background: rgba(255, 149, 0, .14); color: var(--warn); }
.ear-pill.s-need-tap .dot, .ear-pill.s-error .dot { background: var(--warn); animation: blink 1.4s infinite; }
.ear-pill.s-denied { background: rgba(255, 59, 48, .1); color: var(--danger); }
.ear-pill.s-denied .dot { background: var(--danger); }
.ear-pill.s-starting .dot { background: var(--accent); animation: blink 1s infinite; }
.view.chat-view > .topbar .ear-pill { margin-bottom: 0; }
@media (max-width: 420px) { .ear-pill { font-size: 12px; padding: 4px 9px 4px 8px; } .topbar h1 { font-size: 30px; } }

/* ---------- «Ухо»: панель ответа в стиле Siri поверх любой вкладки ---------- */
.siri-panel {
  position: fixed; z-index: 70; left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-radius: 26px; box-shadow: var(--shadow-float); padding: 12px 12px 12px 14px;
  transform: translateY(24px) scale(.98); opacity: 0; transition: transform .45s var(--ease), opacity .3s var(--ease);
}
.siri-panel.open { transform: none; opacity: 1; }
.siri-row { display: flex; gap: 12px; align-items: flex-start; }
.siri-panel .orb { width: 44px; height: 44px; flex: none; box-shadow: 0 0 22px rgba(94, 92, 230, .45); }
.siri-body { flex: 1; min-width: 0; }
.siri-body .voice-status { font-size: 12px; color: var(--muted); opacity: 1; font-weight: 500; }
.siri-body .you { font-size: 14px; color: var(--muted); margin-top: 2px; }
.siri-body .bot { font-size: 16px; line-height: 1.38; margin-top: 2px; max-height: 32vh; overflow-y: auto; }
.siri-body .voice-actions { justify-content: flex-start; margin-top: 6px; }
.siri-body .voice-actions .chip { background: var(--accent-soft); color: var(--accent); }
.siri-close { border: 0; background: var(--fill); color: var(--muted); width: 28px; height: 28px; border-radius: 50%; flex: none; font-size: 13px; }
@media (min-width: 900px) { .siri-panel { left: calc(var(--side) + 50% - var(--side) / 2 - 300px); right: auto; width: 600px; bottom: 24px; } }

/* ---------- зрение: картинки в чате ---------- */
.attach-tray { display: flex; gap: 8px; padding: 8px 14px 0; overflow-x: auto; }
.attach-chip { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; flex: none; background: var(--fill); display: grid; place-items: center; }
.attach-chip img { width: 100%; height: 100%; object-fit: cover; }
.attach-chip button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 0; }
.msg-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; margin: -4px -10px 6px; }
.msg-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; cursor: zoom-in; display: block; background: rgba(255,255,255,.2); }
.msg.user.with-images { min-width: 180px; }
.full-image { width: 100%; height: auto; border-radius: 12px; display: block; }
@media (min-width: 900px) { .attach-tray { padding-left: var(--gutter); padding-right: var(--gutter); } }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 6px 0; border-radius: 10px; -webkit-overflow-scrolling: touch; }
.md-table { border-collapse: collapse; font-size: 14px; min-width: 100%; background: var(--surface); }
.md-table th, .md-table td { padding: 6px 10px; text-align: left; border-bottom: .5px solid var(--line); white-space: nowrap; vertical-align: top; }
.md-table th { font-weight: 600; background: var(--fill); position: sticky; top: 0; }
.md-table td { font-variant-numeric: tabular-nums; }
.msg.assistant .md-table { background: transparent; }
.sheet .table-wrap { max-height: 55vh; border: .5px solid var(--line); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center; }

/* ---------- хранение данных ---------- */
.path-row { align-items: flex-start; }
.path-row .path { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; word-break: break-all; }

/* ---------- меню «+» и вложения-документы ---------- */
.attach-btn .ic { transition: transform .25s cubic-bezier(.32,.72,0,1); }
.attach-menu {
  position: fixed; z-index: 60; min-width: 230px; max-width: calc(100vw - 24px); padding: 6px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.18), 0 0 0 .5px var(--line);
  animation: am-in .22s cubic-bezier(.32,.72,0,1);
}
@keyframes am-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .attach-menu { animation: none; } }
.attach-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 10px 12px; border-radius: 10px; text-align: left; font-size: 16px;
}
.attach-menu button:hover, .attach-menu button:focus-visible { background: var(--fill); outline: none; }
.attach-menu .am-ic { font-size: 20px; width: 26px; text-align: center; }
.attach-menu .am-text { display: flex; flex-direction: column; }
.attach-menu .am-text b { font-weight: 500; }
.attach-menu .am-text small { color: var(--muted); font-size: 13px; }
.col-menu { min-width: 210px; }

.attach-chip.doc { width: auto; min-width: 150px; max-width: 230px; padding: 8px 32px 8px 10px; display: flex; gap: 8px; align-items: center; place-items: initial; }
.attach-chip .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 0; }
.doc-ic { font-size: 24px; flex: none; }
.doc-text { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.doc-text b { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-text small { font-size: 12px; color: var(--muted); }
.msg-docs { display: flex; flex-direction: column; gap: 6px; margin: 0 -6px 8px; }
.doc-card { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 14px; padding: 8px 12px; background: rgba(255,255,255,.18); color: inherit; text-align: left; max-width: 280px; }
.msg.user .doc-card small { color: rgba(255,255,255,.8); }
.doc-thumb { display: block; max-width: 220px; width: 60%; border-radius: 10px; box-shadow: 0 0 0 .5px var(--line); margin: 0 0 12px; }
.doc-text-view { max-height: 55vh; overflow: auto; padding: 12px; border-radius: 12px; background: var(--fill); font-size: 15px; }
.drop-hover::after { content: "Отпусти, чтобы прикрепить"; position: fixed; inset: 12px; border: 2px dashed var(--accent); border-radius: 20px; display: grid; place-items: center; font-size: 20px; color: var(--accent); background: rgba(0,113,227,.06); pointer-events: none; z-index: 70; }
.file-card { display: flex; gap: 12px; align-items: center; text-align: left; }
.file-thumb { width: 44px; height: 56px; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 .5px var(--line); flex: none; background: #fff; }
.file-big-ic { font-size: 30px; width: 44px; text-align: center; flex: none; }

/* ---------- редактор таблиц ---------- */
.table-title { width: 100%; font-size: 20px; font-weight: 600; border: 0; background: transparent; padding: 4px 2px 10px; color: var(--text); outline: none; }
.edit-wrap { max-height: 55vh; border-radius: 12px; box-shadow: 0 0 0 .5px var(--line); }
.md-table.editable td, .md-table.editable .th-label { outline: none; cursor: text; min-width: 60px; }
.md-table.editable td:focus, .md-table.editable .th-label:focus { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface); border-radius: 4px; }
.md-table.editable th { white-space: nowrap; }
.md-table .th-label { display: inline-block; min-width: 40px; padding: 1px 2px; }
.md-table .th-menu { border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 0 0 0 4px; cursor: pointer; }
.md-table .rownum { color: var(--muted); font-size: 12px; text-align: right; width: 28px; min-width: 28px; cursor: pointer; user-select: none; }
.md-table tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: var(--fill); }
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.save-state { margin-left: auto; }

/* ---------- «Мои файлы» ---------- */
.vault-bar { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 12px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 15px; }
.crumbs button { border: 0; background: transparent; color: var(--accent); padding: 4px 6px; border-radius: 8px; font-size: 15px; }
.crumbs button.active { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--muted); }
.vault-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vault-item { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.vault-item .body { flex: 1; min-width: 0; }
.vault-item .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-btn { flex: none; width: 32px; height: 32px; font-size: 18px; color: var(--muted); background: transparent; }
.attach-menu button.danger, .attach-menu button.danger b { color: var(--danger); }
.folder-pick { max-height: 45vh; overflow: auto; }
.folder-pick .item { width: 100%; border: 0; background: transparent; text-align: left; color: var(--text); }
.saved-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px -4px 2px; }
.saved-badges button { border: 0; border-radius: 980px; padding: 3px 10px; font-size: 13px; background: rgba(255,255,255,.22); color: inherit; }

/* ---------- подтверждение удаления и показанные файлы ---------- */
.confirm-card { margin: 10px 0 4px; padding: 12px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px rgba(255,59,48,.35); display: flex; flex-direction: column; gap: 10px; }
.confirm-title { font-weight: 600; font-size: 15px; }
.confirm-row { display: flex; flex-direction: column; gap: 8px; }
.confirm-row + .confirm-row { border-top: .5px solid var(--line); padding-top: 10px; }
.confirm-text { font-size: 15px; }
.confirm-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.confirm-row.closed .btn { display: none; }
.confirm-row.closed .confirm-text { color: var(--muted); }
.confirm-state { font-size: 13px; color: var(--muted); }
.shown-files { margin: 8px 0 4px; }
.shown-img { position: relative; margin: 0; cursor: zoom-in; }
.shown-img img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; }
.shown-img figcaption { position: absolute; left: 6px; bottom: 6px; font-size: 12px; padding: 1px 7px; border-radius: 980px; background: rgba(0,0,0,.55); color: #fff; }
.num-badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0 5px; margin-right: 6px; vertical-align: 1px; }
.vault-item .meta.desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- долговременная память в «Заметках» ---------- */
.memory-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; border: 0; background: transparent; text-align: left; color: var(--text); }
.memory-item .title { white-space: normal; font-weight: 400; line-height: 1.35; }
.mem-ic { font-size: 20px; flex: none; margin-top: 1px; }
.shown-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.shown-bar .meta { margin-right: auto; }
.msg-docs:empty, .msg-images:empty { display: none; }
.shown-files .msg-images { grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 -6px; }
.shown-files .shown-img img { border-radius: 10px; }
.shown-files .shown-img figcaption { font-size: 11px; padding: 0 5px; left: 4px; bottom: 4px; }
@media (min-width: 900px) { .shown-files .msg-images { grid-template-columns: repeat(5, 1fr); } }

/* доступ с телефона */
.remote-url { display: flex; gap: 14px; align-items: center; margin: 12px 0 4px; flex-wrap: wrap; }
.remote-qr { background: #fff; border-radius: 12px; padding: 6px; line-height: 0; flex: none; }
.remote-qr svg { width: 156px; height: 156px; display: block; }
.remote-link { font-weight: 600; word-break: break-all; margin: 4px 0 8px; user-select: all; }
.remote-steps { margin: 10px 0 4px; padding-left: 20px; font-size: 15px; color: var(--muted); }
.remote-steps li { margin: 4px 0; }

/* сайты для ассистента и «Браузер ассистента» */
.site-list { margin: 8px 0 12px; }
.site-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 0.5px solid var(--line); }
.site-main { flex: 1; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; min-width: 0; }
.site-ic { width: 28px; height: 28px; border-radius: 7px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.site-text { display: flex; flex-direction: column; min-width: 0; }
.site-text small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-screen { width: 100%; border-radius: 10px; border: 0.5px solid var(--line); background: #fff; display: block; cursor: pointer; min-height: 120px; touch-action: manipulation; }
.live-url { word-break: break-all; margin: 4px 2px 6px; font-size: 12px; }
.live-note { color: var(--danger); min-height: 0; margin: 4px 2px; }
.live-type { display: flex; gap: 8px; margin: 10px 0 6px; }
.live-type input { flex: 1; min-width: 0; }
.live-keys { flex-wrap: wrap; gap: 6px; }
.confirm-shot { display: block; max-width: 220px; max-height: 140px; margin-top: 6px; border-radius: 8px; border: 0.5px solid var(--line); cursor: zoom-in; }
.shown-img.shot img { object-fit: cover; object-position: top; }
.live-screen.narrow { max-width: 430px; margin: 0 auto; }

/* аккаунты */
.site-row.disabled .site-text b { color: var(--muted); text-decoration: line-through; }
.login-card { background: var(--fill); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.login-card pre { white-space: pre-wrap; font: 15px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 6px 0; user-select: all; }

/* ================= компактный режим телефона (по умолчанию; «Настройки → Вид → Обычный» отключает) =================
   Цель — в 1,5–2 раза больше строк на экране. Поля ввода оставлены 16px: при меньшем шрифте Safari на iPhone
   увеличивает страницу при фокусе. Цели касания не меньше 30–34px. На ПК (≥ 900px) ничего не меняется. */
@media (max-width: 899px) {
  html.compact { --tabbar-h: 48px; --radius: 13px; --radius-s: 11px; }
  html.compact body { font-size: 15px; line-height: 1.4; letter-spacing: -.012em; }
  /* шапка экрана: заголовок в одну строку, капсула «Ухо» не налезает */
  html.compact .topbar { padding: calc(var(--safe-top) + 8px) 14px 4px; gap: 8px; align-items: center; }
  html.compact .topbar h1 { font-size: 22px; line-height: 1.2; letter-spacing: -.02em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  html.compact .topbar h1 > :not(.sub) { white-space: nowrap; }
  html.compact .topbar .sub { font-size: 12.5px; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.compact .icon-btn { width: 32px; height: 32px; font-size: 17px; margin-bottom: 0; }
  html.compact .icon-btn.text { width: auto; padding: 0 11px; font-size: 13.5px; }
  html.compact .ear-pill { font-size: 11.5px; padding: 3px 8px; max-width: 28vw; flex: 0 1 auto; min-width: 22px; }
  html.compact .topbar > :not(h1) { flex-shrink: 0; }
  html.compact .topbar > .ear-pill { flex-shrink: 1; }
  html.compact .view { padding: 2px 12px calc(var(--tabbar-h) + var(--safe-bottom) + 16px); }
  /* разделы, карточки, списки */
  html.compact .section-title { font-size: 16.5px; margin: 14px 2px 6px; }
  html.compact .section-title button { font-size: 14.5px; }
  html.compact .card { padding: 10px 12px; margin-bottom: 8px; }
  html.compact .item { padding: 7px 12px; min-height: 38px; gap: 10px; align-items: center; }
  html.compact .item + .item::before { left: 44px; }
  /* «10:00  Встреча · Офис» — в одну строку, если влезает */
  html.compact .item .body { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
  html.compact .item .title { font-size: 15px; line-height: 1.3; }
  html.compact .item .meta { margin-top: 0; font-size: 12.5px; line-height: 1.3; }
  html.compact .item .meta:empty { display: none; }
  html.compact .item .time { min-width: 42px; font-size: 13.5px; line-height: 1.3; padding-top: 0; align-self: flex-start; margin-top: 1px; }
  html.compact .item .check { width: 21px; height: 21px; font-size: 11px; align-self: flex-start; margin-top: 0; }
  html.compact .meta { font-size: 12.5px; line-height: 1.35; }
  html.compact .tag, html.compact .pill { font-size: 11px; padding: 0 6px; margin-top: 2px; }
  html.compact .empty { padding: 16px 12px; font-size: 14px; }
  html.compact .kv { padding: 7px 0; font-size: 14px; gap: 10px; }
  html.compact .disclosure, html.compact .link-btn { font-size: 14px; padding: 6px 2px; }
  /* заметки: заголовок + 2 строки превью, дата мелко */
  html.compact .note-card { padding: 9px 12px; }
  html.compact .note-card .title { font-size: 15px; line-height: 1.3; }
  html.compact .note-card .preview { font-size: 13.5px; -webkit-line-clamp: 2; margin-top: 2px; line-height: 1.35; }
  html.compact .note-card .meta { margin-top: 3px; font-size: 11.5px; }
  html.compact .search { padding: 7px 10px 7px 32px; background-size: 15px; background-position: 10px center; }
  html.compact .segmented { margin: 8px 0; }
  html.compact .segmented button { padding: 5px 7px; font-size: 12.5px; letter-spacing: -.02em; }
  html.compact .banner { padding: 9px 12px; margin-bottom: 8px; font-size: 13.5px; border-radius: 12px; }
  /* кнопки и переключатели */
  html.compact .btn { padding: 7px 15px; font-size: 15px; min-height: 36px; }
  html.compact .btn.small, html.compact .kv .btn { min-height: 28px; padding: 3px 10px; font-size: 13px; }
  html.compact .btn-row { gap: 8px; }
  html.compact .switch { padding: 6px 0; min-height: 36px; font-size: 14.5px; }
  html.compact .switch input { width: 44px; height: 26px; }
  html.compact .switch input::after { width: 22px; height: 22px; }
  html.compact .switch input:checked::after { left: 20px; }
  /* календарь: клетки ниже, сетка месяца — треть экрана, а не половина */
  html.compact .cal-head { margin-bottom: 2px; }
  html.compact .cal-head h2 { font-size: 17px; }
  html.compact .cal-head .icon-btn { width: 30px; height: 30px; }
  html.compact .cal-grid .dow { font-size: 10.5px; padding: 2px 0; }
  html.compact .cal-day { aspect-ratio: auto; height: 36px; width: 36px; font-size: 15px; gap: 1px; }
  html.compact .cal-day .dots { height: 3px; }
  html.compact .cal-day .dots i { width: 3px; height: 3px; }
  /* чат */
  html.compact .view.chat-view { padding: 0; }
  html.compact .view.chat-view > .topbar { padding: calc(var(--safe-top) + 6px) 12px 6px; }
  html.compact .view.chat-view > .topbar h1 { font-size: 16px; }
  html.compact .view.chat-view > .topbar .sub { display: none; }
  html.compact .messages { padding: 8px 10px 6px; gap: 5px; }
  html.compact .msg { font-size: 15.5px; line-height: 1.36; padding: 6px 11px; border-radius: 17px; max-width: 84%; }
  html.compact .msg.user { border-bottom-right-radius: 5px; }
  html.compact .msg.assistant { border-bottom-left-radius: 5px; position: relative; }
  html.compact .msg code { font-size: 13.5px; }
  html.compact .actions { gap: 4px; margin-top: 5px; }
  html.compact .chip { font-size: 12px; padding: 3px 9px; }
  /* «🔊» — кружок справа от пузыря, не занимает отдельную строку */
  html.compact .msg.assistant .msg-tools { position: absolute; right: -32px; bottom: 0; margin: 0; }
  html.compact .msg.assistant .msg-tools button { width: 26px; height: 26px; padding: 0; font-size: 13px; border-radius: 50%; display: grid; place-items: center; }
  html.compact .suggestions { padding: 0 10px 6px; gap: 6px; }
  html.compact .suggestions button { padding: 5px 11px; font-size: 13.5px; }
  html.compact .composer { padding: 6px 8px; gap: 6px; }
  html.compact .composer textarea { min-height: 34px; padding: 6px 12px; font-size: 16px; border-radius: 18px; }
  html.compact .round { width: 34px; height: 34px; font-size: 17px; }
  /* таб-бар */
  html.compact .tabbar button { font-size: 10px; gap: 1px; }
  html.compact .tabbar button .ic { font-size: 22px; }
  /* шторки и формы (поля — 16px, чтобы Safari не увеличивал страницу) */
  html.compact .sheet { padding: 4px 14px calc(var(--safe-bottom) + 14px); }
  html.compact .sheet .grabber { margin: 3px auto 8px; }
  html.compact .sheet h3 { font-size: 18px; margin: 0 0 10px; }
  html.compact .field { margin-bottom: 9px; }
  html.compact .field > span { font-size: 12px; margin: 0 4px 3px; }
  html.compact .field input, html.compact .field select, html.compact .field textarea { padding: 8px 11px; min-height: 38px; font-size: 16px; }
  html.compact .field textarea { min-height: 96px; }
  html.compact .toast { font-size: 14px; padding: 9px 14px; }
  /* «Браузер ассистента», аккаунты, сайты */
  html.compact .site-row { padding: 6px 0; }
  html.compact .site-ic { width: 24px; height: 24px; font-size: 17px; }
  html.compact .site-text small { font-size: 12px; }
}

/* компактный режим: маленькие на вид кнопки нажимаются по области ≥ 36px (невидимый «запас» вокруг) */
@media (max-width: 899px) {
  html.compact .item .check, html.compact .section-title button, html.compact .ear-pill { position: relative; }
  html.compact .item .check::after, html.compact .section-title button::after, html.compact .ear-pill::after {
    content: ""; position: absolute; inset: -8px -6px;
  }
}

/* сворачиваемые разделы настроек (во всех режимах — так их легче пролистать) */
.fold { margin: 0; }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary.section-title::after { content: "›"; margin-left: auto; color: var(--tertiary); font-weight: 400; font-size: 1.15em; transform: rotate(90deg); transition: transform .2s var(--ease); order: 9; }
.fold:not([open]) > summary.section-title::after { transform: none; }
.fold:not([open]) > summary.section-title { color: var(--text); margin-bottom: 0; padding: 8px 2px; border-bottom: .5px solid var(--line); }
.fold[open] > summary.section-title { margin-bottom: 6px; }
.fold > summary .fold-hint { font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
/* баннер в одну строку: «Установи на экран Домой · Как? · ✕» */
.banner.slim { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.banner.slim .grow { flex: 1; min-width: 0; font-weight: 600; }
.banner.slim .x { border: 0; background: none; color: var(--muted); font-size: 16px; padding: 2px 4px; }
.banner.slim .steps { flex-basis: 100%; margin: 4px 0 0; font-weight: 400; }

/* вход по шагам и «Безопасность» */
.login-step { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.login-step .step-hint { text-align: left; }
.code-input { font-size: 20px !important; letter-spacing: .18em; text-align: center; }
.passkey-btn { margin-top: 8px; }
.approval-wait { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--fill-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sec-pending { background: rgba(255, 149, 0, .12); border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
.sec-head { font-weight: 600; margin: 12px 0 2px; font-size: 14px; }
.kv.sub { font-size: 13px; }
.sec-journal { margin-top: 10px; }
.sec-journal summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.backup-codes, .totp-secret { font: 16px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; word-break: break-all; }
.backup-codes { background: var(--fill); padding: 10px 12px; border-radius: 10px; columns: 2; }
.internet-box { margin-top: 10px; padding-top: 6px; border-top: .5px solid var(--line); }
.inet-check { margin: 8px 0; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4; background: var(--fill, rgba(120,120,128,.12)); }
.inet-check div { margin-top: 4px; color: var(--muted); }
.inet-check.ok b { color: var(--ok); } .inet-check.no_cap b, .inet-check.no_https b { color: var(--danger); }
.warn-list ul { margin: 4px 0 0; padding-left: 18px; }
.code-input::placeholder { letter-spacing: normal; }
.login .code-input { background-image: none; padding-left: 12px; }

/* 0.22: карточка плана, живой ответ */
.plan-card { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--text); border: .5px solid var(--line); }
.plan-card b, .plan-steps { color: var(--text); }
.plan-card .meta { color: var(--muted); }
.plan-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-head .pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.plan-steps { margin: 8px 0 6px; padding-left: 22px; font-size: 14.5px; line-height: 1.45; }
.plan-steps li { margin: 3px 0; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.plan-state { font-size: 12.5px; color: var(--muted); }
.plan-foot .btn-row { margin: 0; }

/* 0.22: удаление из списка, выбор пачкой */
.item { position: relative; }
.row-del { order: 99; margin-left: auto; flex: none; background: none; border: 0; font-size: 15px; opacity: .45; padding: 6px; cursor: pointer; }
.row-del:hover, .row-del:focus-visible { opacity: 1; }
.pick-list { max-height: 55vh; overflow: auto; margin: 8px 0; }
.pick-row { display: flex; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: .5px solid var(--line); font-size: 15px; }
.pick-row input { width: 20px; height: 20px; flex: none; }
.pick-row.is-done span { color: var(--muted); text-decoration: line-through; }

/* 0.22.3: версия программы рядом с «Ассистент» */
.app-ver { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; letter-spacing: 0; color: var(--muted);
  vertical-align: middle; padding: 1px 7px; border-radius: 980px; background: var(--fill); }
.topbar h1 .app-ver { margin-left: 2px; position: relative; top: -2px; }
.tabbar .brand .app-ver { display: flex; width: fit-content; margin-top: 3px; }
.app-ver.stale { color: var(--warn); }
.ver-reload { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.login-ver { font-size: 12.5px; color: var(--muted); margin: -4px 0 8px; }
