/* Выделение, нажатия и значки разделов */
* { -webkit-tap-highlight-color: transparent; }
button:focus:not(:focus-visible), .nav-item:focus:not(:focus-visible), summary:focus:not(:focus-visible) { outline: none; }
button:focus-visible, .btn:focus-visible, .btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-button { transition: background-color .18s, color .18s; }
.icon-button:active { border-radius: 50%; }
/* На сенсорном экране «наведение» залипало после касания квадратной плашкой. */
@media (hover: none) {
  .icon-button:hover:not(.active):not(.primary) { background: transparent; color: var(--muted); }
  .icon-button.round:hover:not(.active) { color: var(--text); }
  .icon-button.primary:hover { background: var(--accent); color: var(--accent-text); }
  .icon-button:active:not(.primary) { background: #1e96eb22; }
  .btn:hover { background: var(--card); }
  .nav-item:hover:not(.active) { background: none; }
}

/* Выделенный текст — спокойный голубой, как в Google Документах. */
::selection { background: #b6d5fd; color: #111; }
:root[data-theme="dark"] ::selection { background: #3d6aa8; color: #fff; }
#editor, #chat-input { caret-color: var(--accent); }

/* Значки разделов */
.icon .soft { fill: currentColor; fill-opacity: 0; transition: fill-opacity .25s; }
.icon .line { stroke-width: 1.9; }
.nav-item .icon { stroke-width: 1.5; }
.nav-item.active .icon .soft { fill-opacity: .18; }
@media (max-width: 760px) {
  .nav-item { position: relative; color: var(--muted); }
  .nav-item.active { background: none; color: var(--accent); }
  .nav-item .icon { width: 31px; height: 31px; transition: translate .25s cubic-bezier(.3, 1.6, .5, 1); }
  .nav-item.active .icon { translate: 0 -3px; }
  .nav-item::after { content: ""; position: absolute; bottom: 9px; left: 50%; width: 0; height: 4px; border-radius: 2px; background: var(--accent); translate: -50% 0; transition: width .25s cubic-bezier(.3, 1.6, .5, 1); }
  .nav-item.active::after { width: 18px; }
}

/* Панель над выделенным текстом и лист обработки */
#selection-bar { position: fixed; z-index: 30; display: flex; gap: 2px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 2px 6px #3c40434d, 0 6px 20px #3c404326; animation: rise .16s ease-out; user-select: none; -webkit-user-select: none; }
#selection-bar button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; background: none; border: 0; border-radius: 18px; font-size: 13px; white-space: nowrap; }
#selection-bar button:hover { background: var(--hover); }
#selection-bar .icon { width: 17px; height: 17px; color: var(--accent); }
dialog#text-tool { width: min(640px, 96vw); max-height: 92dvh; }
#tt-original { max-height: 90px; overflow-y: auto; margin: 6px 0; padding: 8px 12px; border-left: 3px solid #b6d5fd; background: var(--side); border-radius: 0 10px 10px 0; white-space: pre-wrap; font-size: 13px; }
#tt-tabs { display: flex; margin: 6px 0; }
#tt-tabs button { flex: 1; width: auto; height: 36px; font-size: 13px; }
.tt-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.tt-chips .input { flex: 1; min-width: 120px; }
#tt-strength { flex: 1; accent-color: var(--accent); min-height: 32px; }
#tt-percent { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
#tt-prompt { width: 100%; resize: vertical; }
#tt-model { border-top: 1px solid var(--line); padding-top: 6px; }
#tt-model summary { cursor: pointer; display: flex; gap: 8px; align-items: center; min-height: 36px; font-size: 14px; }
#tt-model .field-label { width: 100%; font-size: 12px; }
#tt-output { white-space: pre-wrap; max-height: 34vh; overflow-y: auto; margin-top: 8px; padding: 12px; border: 1px solid var(--accent); border-radius: 12px; }

.language { display: inline-flex; align-items: center; }
.language-remove.icon-button { width: 26px; height: 26px; margin-left: -4px; }
.language-remove .icon { width: 13px; height: 13px; }
#selection-bar .icon-button { min-height: 0; }

/* Выбор из двух: режим синхронизации и сеть */
.segmented.choice { display: flex; margin: 8px 0; }
.segmented.choice button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; width: auto; height: 40px; font-size: 13px; }
.net-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 4px 0; }
.net-line.ok .icon { color: #34a853; }
.net-line.warn { color: var(--warn); }

/* Поиск в заметках: одно поле, способ — значком внутри него */
.note-field { position: relative; display: flex; align-items: center; }
.note-field .input { width: 100%; padding-right: 46px; border-radius: 22px; padding-left: 16px; }
#note-mode { position: absolute; right: 4px; width: 36px; height: 36px; border-radius: 50%; color: var(--accent); }
#note-mode-menu { width: 290px; }
