/* Низ чата */
.composer-row { gap: 8px; }
.icon-button.round { position: relative; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); }
#gear-badge { position: absolute; right: -4px; bottom: -4px; display: grid; place-content: center; width: 19px; height: 19px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); }
#gear-badge .icon { width: 12px; height: 12px; stroke-width: 2; }
.icon-button.action-button { width: 54px; height: 54px; box-shadow: 0 4px 14px #1e96eb55; animation: pop .22s cubic-bezier(.3, 1.6, .6, 1); }
.icon-button.action-button:hover { background: var(--accent); color: var(--accent-text); filter: brightness(1.06); }
.icon-button.action-button:active { background: var(--accent); }
.icon-button.action-button.stopping { background: var(--danger); }
.action-button .icon { width: 26px; height: 26px; }
#send-button { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
@keyframes pop { from { transform: scale(.6); opacity: .3; } }
#mic-bubble { position: fixed; z-index: 26; translate: -50% -100%; display: grid; place-content: center; width: 60px; height: 60px; border: 0; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #1e96eb, #8f6bf0); box-shadow: 0 8px 26px #1e96eb66; animation: bubble .34s cubic-bezier(.25, 1.7, .5, 1); transition: scale .15s, box-shadow .15s; }
#mic-bubble .icon { width: 28px; height: 28px; }
#mic-bubble.armed { scale: 1.22; box-shadow: 0 0 0 10px #1e96eb33, 0 8px 30px #8f6bf077; }
@keyframes bubble { from { transform: translateY(46px) scale(.3); opacity: 0; } }

/* Меню настроек чата */
#chat-menu { width: min(380px, calc(100vw - 16px)); }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 12px; background: none; border: 0; border-radius: 12px; text-align: left; }
.menu-row:hover { background: var(--hover); }
.menu-row .model-text { flex: 1; }
.menu-row > .icon:last-child { color: var(--muted); }
.menu-back { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 8px; background: none; border: 0; border-bottom: 1px solid var(--line); font-weight: 600; text-align: left; }
.menu-sub { padding-top: 4px; animation: slide-in .2s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateX(18px); } }
.switch { position: relative; flex: none; width: 42px; height: 24px; border-radius: 12px; background: var(--line); transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0005; transition: transform .18s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.base-row { display: flex; align-items: center; gap: 6px; padding: 1px 6px 1px 12px; }
.base-row .base-label { min-height: 40px; }
.base-row input { width: 18px; height: 18px; }
.model-group .icon { width: 14px; height: 14px; vertical-align: -2px; }
.chip.far .icon { color: var(--accent); }
dialog.sheet { width: min(580px, 96vw); }
dialog.sheet h3 { margin: 0; overflow-wrap: anywhere; }
dialog.sheet .input { width: 100%; }
.sheet-body { max-height: 60vh; overflow-y: auto; margin-top: 8px; }

/* Вложения и вставка */
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin: 4px 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text) !important; text-decoration: none; overflow-wrap: anywhere; }
.file-chip .icon { color: var(--accent); }
.attach-thumb.attach-doc { width: 130px; }
.attach-doc > span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 12px; }
.attach-doc small { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.fly-image { position: fixed; z-index: 60; margin: 0; object-fit: cover; pointer-events: none; }
#camera-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#insert-menu { width: 280px; }
#preview { -webkit-touch-callout: default; }
#record-sheet { position: fixed; z-index: 24; left: 50%; bottom: 14px; translate: -50% 0; width: min(560px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 44px #0006; }

/* Заметки: поиск и граф */
#side-files .panel-head { flex-wrap: wrap; justify-content: space-between; }
#side-files .panel-head span { flex-basis: 100%; }
#notes-search { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
#note-results .item { white-space: normal; padding: 8px; }
#note-results .item small { white-space: nowrap; }
#note-results .btn-primary { margin: 6px 0; justify-content: center; }
#graph { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#graph:active { cursor: grabbing; }
#vault-back { margin-right: 2px; }

/* Телефон */
@media (max-width: 760px) {
  :root { --nav-h: 64px; }
  /* Внизу только крупные значки. */
  #sidebar { height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  #rail { height: var(--nav-h); align-items: stretch; }
  .nav-item { flex: 1; justify-content: center; align-items: center; padding: 0; }
  .nav-item span { display: none; }

  /* Раздел «Заметки» без открытой заметки: дерево на весь экран, а не выезжающая панель. */
  body.notes-home #side-files { transform: none; transition: none; width: 100%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 6; background: var(--bg); padding: 10px 12px; }
  .side-panel .panel-head { flex-wrap: wrap; justify-content: flex-start; gap: 2px; }
  #side-files .panel-head span { flex-basis: 100%; font-size: 22px; font-weight: 700; color: var(--text); padding: 2px 4px; }
  #side-files .panel-head .icon-button { flex: 1; }

  /* Крупнее всё, по чему нажимают пальцем. */
  .icon-button, .panel-head .icon-button { width: 44px; height: 44px; }
  .icon-button .icon, .panel-head .icon { width: 23px; height: 23px; }
  .icon-button.round { width: 46px; height: 46px; }
  .icon-button.action-button { width: 58px; height: 58px; }
  .action-button .icon { width: 28px; height: 28px; }
  .message-tools .icon-button { width: 40px; height: 40px; }
  .btn, .btn-primary { min-height: 44px; padding: 8px 16px; font-size: 15px; }
  .input { min-height: 44px; font-size: 16px; }
  .chip { padding: 8px 14px; font-size: 13px; }
  .item { padding: 11px 10px; font-size: 16px; }
  .tree-folder > summary { padding: 11px 8px; font-size: 16px; }
  .segmented button { width: 44px; height: 40px; }
  .cal-view-button { min-height: 40px; }
  .player-play { width: 44px; height: 44px; }
  .menu-item.btn { min-height: 50px; }

  /* Действия заметки — отдельной строкой, чтобы не мельчить. */
  #view-files .view-header { flex-wrap: wrap; }
  #view-files #file-actions { order: 3; width: 100%; justify-content: space-between; overflow-x: auto; }
  #record-sheet { bottom: calc(var(--nav-h) + 8px); }
  #toast { left: 50%; }
}
