/* @llm-section:
purpose: базовая палитра и переменные псевдо-3D интерфейса
invariant: цветовая тема меняется только через CSS-переменные body.theme-*
*/
:root,
body.theme-gray {
  --bg: #9fa3a6;
  --panel: #c4c7c9;
  --panel-dark: #aeb2b5;
  --line-light: #f0f1f2;
  /* --line-dark: #72777b; четкие границы*/
  --line-dark: rgba(114, 119, 123, 0.15);
  --border-strong: #666b6f;
  --field-border: #6c7175;
  --list-border: #74797d;
  --text: #17191b;
  --muted: #555b60;
  --icon: #202326;
  --danger-icon: #442525;
  --shadow: rgba(22, 24, 26, .35);
  --inset: rgba(255, 255, 255, .62);
  --radius: 10px;
  --accent-ok: #5d7569;
  --accent-bad: #8b5f5f;
  --accent-warn: #817556;
  --body-bg: radial-gradient(circle at 50% 20%, rgba(120, 190, 140, 0.22), transparent 55%), linear-gradient(180deg, #cfd4d3 0%, #aeb5b3 100%);
  --surface-bg: linear-gradient(180deg, #d4d7d9 0%, var(--panel) 48%, #b6babd 100%);
  --control-bg: linear-gradient(180deg, #e0e2e4 0%, #bec2c5 52%, #a7abae 100%);
  --control-active-bg: linear-gradient(180deg, #b8bdc0, #969da1);
  --field-bg: linear-gradient(180deg, #e2e4e5, #d2d5d7);
  --field-readonly-bg: linear-gradient(180deg, #d4d7d9, #c2c6c8);
  --list-item-bg: linear-gradient(180deg, #d0d3d5, #b8bcbe);
  --input-bg: linear-gradient(180deg, #e4e6e7, #ccd0d2);
  --badge-bg: linear-gradient(180deg, #cfd2d4, #b3b7ba);
  --scroll-list-track: #c3c7c9;
  --scroll-list-thumb: #7e858a;
  --scroll-list-thumb-hover: #62696e;
}


body.theme-green {
  --bg: #90b1a0;
  --panel: #bfd2c8;
  --panel-dark: #9fb9ac;
  --line-light: #eff8f3;
  --line-dark: rgba(82, 120, 102, 0.22);
  --border-strong: #5f7b6d;
  --field-border: #6b8a7b;
  --list-border: #6f8c7e;
  --text: #132019;
  --muted: #4f6559;
  --icon: #17251d;
  --danger-icon: #4a2626;
  --shadow: rgba(18, 33, 25, .32);
  --inset: rgba(255, 255, 255, .58);
  --accent-ok: #4f7a62;
  --accent-bad: #8b5f5f;
  --accent-warn: #80764e;
  --body-bg: linear-gradient(180deg, #cfeee2 0%, #b7dccb 50%, #9fc9b7 100%);
  --surface-bg: linear-gradient(180deg, #d9e8e0 0%, var(--panel) 48%, #adc5b9 100%);
  --control-bg: linear-gradient(180deg, #e5efe9 0%, #c3d8cd 52%, #a9c2b6 100%);
  --control-active-bg: linear-gradient(180deg, #abc4b8, #8eaa9d);
  --field-bg: linear-gradient(180deg, #e9f1ed, #d4e3dc);
  --field-readonly-bg: linear-gradient(180deg, #dce9e3, #c7d9d0);
  --list-item-bg: linear-gradient(180deg, #d6e3dd, #bfd2c8);
  --input-bg: linear-gradient(180deg, #e8f0ec, #d0dfd8);
  --badge-bg: linear-gradient(180deg, #d2e1da, #b5c9bf);
  --scroll-list-track: #b7cfc3;
  --scroll-list-thumb: #6f927f;
  --scroll-list-thumb-hover: #577765;
}


body.theme-blue {
  --bg: #96a9b8;
  --panel: #c1ced8;
  --panel-dark: #a4b6c4;
  --line-light: #eef5fa;
  --line-dark: rgba(82, 104, 122, 0.22);
  --border-strong: #5f7180;
  --field-border: #687d8e;
  --list-border: #718595;
  --text: #121b22;
  --muted: #4d5f6d;
  --icon: #17212a;
  --danger-icon: #4a2626;
  --shadow: rgba(16, 25, 33, .33);
  --inset: rgba(255, 255, 255, .6);
  --accent-ok: #526f67;
  --accent-bad: #8b5f5f;
  --accent-warn: #817556;
  --body-bg: linear-gradient(180deg, #d6e8f4 0%, #bed3e2 50%, #9eb8cc 100%);
  --surface-bg: linear-gradient(180deg, #d9e3ea 0%, var(--panel) 48%, #acbfce 100%);
  --control-bg: linear-gradient(180deg, #e4ebf0 0%, #c3d1dc 52%, #a7bac9 100%);
  --control-active-bg: linear-gradient(180deg, #aebfcb, #91a8ba);
  --field-bg: linear-gradient(180deg, #e8eef2, #d2dee6);
  --field-readonly-bg: linear-gradient(180deg, #d8e3ea, #c4d2dc);
  --list-item-bg: linear-gradient(180deg, #d4dee6, #bdccd8);
  --input-bg: linear-gradient(180deg, #e7edf2, #cfdbe4);
  --badge-bg: linear-gradient(180deg, #d0dbe3, #b4c3ce);
  --scroll-list-track: #b6c7d4;
  --scroll-list-thumb: #6f8ba0;
  --scroll-list-thumb-hover: #58758b;
}


body.theme-white {
  --bg: #e7e8e6;
  --panel: #f0f1ef;
  --panel-dark: #d8dad7;
  --line-light: #ffffff;
  --line-dark: rgba(120, 124, 122, 0.20);
  --border-strong: #8b908d;
  --field-border: #9a9f9c;
  --list-border: #a0a5a2;
  --text: #151716;
  --muted: #5e6461;
  --icon: #202322;
  --danger-icon: #4a2626;
  --shadow: rgba(25, 27, 26, .22);
  --inset: rgba(255, 255, 255, .78);
  --accent-ok: #5e7569;
  --accent-bad: #8b5f5f;
  --accent-warn: #817556;
  --body-bg: linear-gradient(180deg, #ffffff 0%, #eef1ee 48%, #d8ddd9 100%);
  --surface-bg: linear-gradient(180deg, #ffffff 0%, var(--panel) 52%, #dfe2df 100%);
  --control-bg: linear-gradient(180deg, #ffffff 0%, #ecefed 52%, #d8dcd9 100%);
  --control-active-bg: linear-gradient(180deg, #e0e4e1, #c9cecb);
  --field-bg: linear-gradient(180deg, #ffffff, #edf0ee);
  --field-readonly-bg: linear-gradient(180deg, #f4f6f5, #e4e8e5);
  --list-item-bg: linear-gradient(180deg, #f4f6f5, #e5e8e6);
  --input-bg: linear-gradient(180deg, #ffffff, #ecefed);
  --badge-bg: linear-gradient(180deg, #f3f5f4, #dee2df);
  --scroll-list-track: #e3e6e3;
  --scroll-list-thumb: #a9afab;
  --scroll-list-thumb-hover: #8c938f;
}

body.theme-beige {
  --bg: #b9aa94;
  --panel: #d5c7b2;
  --panel-dark: #bda98f;
  --line-light: #fff5e7;
  --line-dark: rgba(126, 104, 76, 0.22);
  --border-strong: #7d6b54;
  --field-border: #8d7a61;
  --list-border: #907c63;
  --text: #221a12;
  --muted: #665743;
  --icon: #2b2117;
  --danger-icon: #4a2626;
  --shadow: rgba(43, 33, 23, .32);
  --inset: rgba(255, 255, 255, .56);
  --accent-ok: #6d7354;
  --accent-bad: #8b5f5f;
  --accent-warn: #8a754a;
  --body-bg: linear-gradient(180deg, #f1dfc4 0%, #d9c4a6 50%, #bfa88a 100%);
  --surface-bg: linear-gradient(180deg, #e9dac4 0%, var(--panel) 48%, #c3b094 100%);
  --control-bg: linear-gradient(180deg, #efe2cf 0%, #d7c7af 52%, #bda98f 100%);
  --control-active-bg: linear-gradient(180deg, #c5b293, #a99170);
  --field-bg: linear-gradient(180deg, #f2e6d5, #dfd0ba);
  --field-readonly-bg: linear-gradient(180deg, #e6d7c2, #cfbea5);
  --list-item-bg: linear-gradient(180deg, #dfd0ba, #c8b79e);
  --input-bg: linear-gradient(180deg, #f0e3d1, #dac9b2);
  --badge-bg: linear-gradient(180deg, #dfd0ba, #c2af93);
  --scroll-list-track: #cbb99d;
  --scroll-list-thumb: #8e7658;
  --scroll-list-thumb-hover: #705b42;
}
body.theme-balanced {
  --bg: #9fb0ad;
  --panel: #c7d0c9;
  --panel-dark: #a7b4ad;
  --line-light: #f4f0df;
  --line-dark: rgba(67, 87, 92, 0.22);
  --border-strong: #53666d;
  --field-border: #697b7a;
  --list-border: #72827d;
  --text: #17201f;
  --muted: #53605f;
  --icon: #1c292b;
  --danger-icon: #6f3d3b;
  --shadow: rgba(31, 42, 45, .32);
  --inset: rgba(255, 255, 255, .58);
  --accent-ok: #5f7d64;
  --accent-bad: #a05d55;
  --accent-warn: #a98545;
  --body-bg: radial-gradient(circle at 15% 10%, rgba(206, 173, 105, 0.30), transparent 38%), radial-gradient(circle at 85% 12%, rgba(99, 145, 172, 0.28), transparent 42%), linear-gradient(180deg, #d9dece 0%, #b8c7c2 52%, #9eb0b0 100%);
  --surface-bg: linear-gradient(180deg, #dde3d8 0%, var(--panel) 48%, #b2bdb7 100%);
  --control-bg: linear-gradient(180deg, #e7e5d8 0%, #c6d0ca 52%, #aab9b8 100%);
  --control-active-bg: linear-gradient(180deg, #b7c4bd, #93a6a7);
  --field-bg: linear-gradient(180deg, #edf0e7, #d6ded8);
  --field-readonly-bg: linear-gradient(180deg, #dfe5da, #c7d2cc);
  --list-item-bg: linear-gradient(180deg, #d8ded2, #bcc8c3);
  --input-bg: linear-gradient(180deg, #eceee3, #d2dbd6);
  --badge-bg: linear-gradient(180deg, #d7dfd5, #b8c5bf);
  --scroll-list-track: #bcc8c3;
  --scroll-list-thumb: #637f8b;
  --scroll-list-thumb-hover: #4d6872;
}


/* Локальный декоративный шрифт заголовка */
@font-face {
  font-family: "Marck Script Local";
  src: url("/static/fonts/MarckScript-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Базовая раскладка страницы */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--body-bg);
}
button, input, textarea { font: inherit; }
.hidden { display: none !important; }
.shell {
  width: min(1040px, calc(100vw - 24px));
  margin: 14px auto;
}

/* Общие рельефные поверхности */
.auth-card,
.app-card,
.panel-card {
  border-radius: var(--radius);
  border: 1px solid var(--line-dark);
  background: var(--surface-bg);
  box-shadow: 0 10px 24px var(--shadow), inset 0 1px 0 var(--line-light), inset 0 -1px 0 rgba(0,0,0,.18);
}
.auth-card {
  max-width: 380px;
  margin: 8vh auto 0;
  padding: 22px;
  text-align: center;
}
.auth-card h1, .brand {
  margin: 0;
  letter-spacing: .04em;
  font-family: "Marck Script Local", "Segoe Print", cursive;
  font-size: 29px;
  font-weight: 400;
}
.app-card { padding: 12px; }
.panel-card { padding: 12px; margin-top: 12px; }

/* Верхняя панель и вкладки */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 8px 10px 12px;
}
/* Заголовок приложения с иконкой */
/* @llm-section:
purpose: keeps the app logo visually bound to the title without changing the topbar height
invariant: logo scales by header height and title remains left-aligned
*/
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  gap: 8px;
}
.brand span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand[role="button"] { cursor: pointer; }
.brand[role="button"]:focus-visible {
  outline: 2px solid rgba(255,255,255,.75);
  outline-offset: 4px;
  border-radius: 8px;
}

/* Индикатор передачи текста через буфер обмена */
.copy-status {
  width: 124px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 124px;
  margin-left: auto;
  color: #000;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
}
.copy-status.is-visible {
  opacity: 1;
  transform: scale(1);
}
.copy-status-icon {
  width: 116px;
  height: 30px;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.28)) drop-shadow(0 2px 2px rgba(0,0,0,.20));
}
.copy-status-dot {
  fill: currentColor;
  opacity: .18;
  animation: copyStatusDotOn .01s linear forwards;
}
.copy-status-icon.flow-ltr .dot-1,
.copy-status-icon.flow-rtl .dot-3 { animation-delay: 0s; }
.copy-status-icon.flow-ltr .dot-2,
.copy-status-icon.flow-rtl .dot-2 { animation-delay: .5s; }
.copy-status-icon.flow-ltr .dot-3,
.copy-status-icon.flow-rtl .dot-1 { animation-delay: 1s; }
@keyframes copyStatusDotOn {
  to { opacity: 1; }
}
.service-status { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.badge,
.session-timer,
.top-service-button {
  min-width: 72px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--line-dark);
  background: var(--badge-bg);
  box-shadow: inset 0 1px 0 var(--inset), inset 0 -1px 2px rgba(0,0,0,.16);
  text-align: center;
  font-size: 13px;
}
.top-service-button {
  appearance: none;
  width: 32px;
  min-width: 32px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

.top-service-icon {
  width: 23px;
  height: 23px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter:
  brightness(0.7)
  contrast(1.4)
  drop-shadow(0 1px 1px rgba(0,0,0,0.85));
}

.top-service-button.active {
  box-shadow: inset 0 3px 7px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.45);
  transform: translateY(1px);
}
.badge {
  appearance: none;
  flex: 0 0 auto;
}
.badge:active {
  box-shadow: inset 0 3px 7px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.45);
  transform: translateY(1px);
}
.badge.online { color: #102016; background: linear-gradient(180deg, #c3cec7, #9dac9f); }
.badge.offline { color: #2c1212; background: linear-gradient(180deg, #d3c0c0, #ad9696); }
.badge.checking { color: #2a2313; background: linear-gradient(180deg, #d1c9b5, #b0a686); }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px;
}
.tab,
.primary-3d,
.key-button,
.icon-button,
.file-upload-button {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--control-bg);
  box-shadow: 0 3px 6px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 1px rgba(0,0,0,.22);
  cursor: pointer;
  user-select: none;
}
.tab {
  flex: 1 1 120px;
  padding: 9px 10px;
  border-radius: 8px;
  font-weight: 700;
}
.tab.active {
  background: var(--control-active-bg);
  box-shadow: inset 0 3px 6px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.4);
}
.tab:active,
.primary-3d:active,
.key-button:active,
.icon-button:active,
.file-upload-button:active {
  transform: translateY(1px);
  box-shadow: inset 0 3px 7px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.35);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Панели обмена */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

/* Счётчики символов в заголовках и строках копилки */
.char-count,
.item-char-count {
  color: var(--muted);
  font-size: .88em;
  font-weight: 500;
}
.item-char-count { margin-left: 7px; }
.icon-row, .item-actions { display: flex; gap: 7px; align-items: center; }
.icon-button {
  width: 40px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-button svg,
#upload-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--icon);
}
.icon-button svg.copy-outline-icon {
  fill: none;
  stroke: var(--icon);
  stroke-width: 1.8;
}
.icon-button.danger svg { fill: var(--danger-icon); }

.undo-text-icon {
  display: inline-block;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", Arial, sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--icon);
  transform: translateY(-4px);
}
/* Состояние недоступной кнопки отмены */
.icon-button:disabled {
  cursor: default;
  opacity: .45;
  transform: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.38);
}
.icon-button:disabled svg { fill: #5b6064; }
.icon-button:disabled .undo-text-icon { color: #5b6064; }
textarea {
  width: 100%;
  min-height: calc(2 * 1.35em + 24px);
  height: 28vh;
  padding: 12px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--field-border);
  color: #111;
  background: var(--field-bg);
  box-shadow: inset 0 3px 9px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.7);
  outline: none;
  line-height: 1.35;
  white-space: pre-line;
  word-break: break-word;
}
textarea[readonly] { background: var(--field-readonly-bg); color: #24272a; }
textarea:focus {
  border-color: #4f565b;
  box-shadow: inset 0 3px 9px rgba(0,0,0,.25), 0 0 0 2px rgba(255,255,255,.28);
}
.flash { animation: server-flash .7s ease-out; }
@keyframes server-flash {
  0% { box-shadow: 0 10px 24px var(--shadow), 0 0 0 4px rgba(255,255,255,.52), inset 0 1px 0 var(--line-light); }
  100% { box-shadow: 0 10px 24px var(--shadow), inset 0 1px 0 var(--line-light), inset 0 -1px 0 rgba(0,0,0,.18); }
}
.status-line {
  min-height: 22px;
  padding: 7px 2px 0;
  color: var(--muted);
  font-size: 14px;
}

/* Экранная цифровая клавиатура входа */
.pin-display {
  height: 46px;
  margin: 18px 0 12px;
  border-radius: 8px;
  border: 1px solid #686e72;
  background: var(--input-bg);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.7);
  line-height: 46px;
  letter-spacing: .25em;
  font-size: 22px;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.key-button {
  height: 48px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 19px;
}
.primary-3d {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
}
.primary-3d.compact { min-height: 34px; padding: 6px 10px; }

/* Кнопки управления сессиями */
.session-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.primary-3d.logout { width: 100%; margin-top: 10px; }
.remember-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
}

/* Списки истории, файлов и сессий */
.list-card { min-height: 62vh; }
.scroll-list {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: var(--scroll-list-thumb) var(--scroll-list-track);
  scrollbar-width: thin;
}
.scroll-list::-webkit-scrollbar {
  width: 10px;
}
.scroll-list::-webkit-scrollbar-track {
  background: var(--scroll-list-track);
  border-radius: 8px;
}
.scroll-list::-webkit-scrollbar-thumb {
  background: var(--scroll-list-thumb);
  border: 2px solid var(--scroll-list-track);
  border-radius: 8px;
}
.scroll-list::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-list-thumb-hover);
}
.list-item {
  position: relative;
  margin: 0 0 10px;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--list-border);
  background: var(--list-item-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58), 0 3px 7px rgba(0,0,0,.18);
}
.list-item pre {
  white-space: pre-line;
  word-break: break-word;
  margin: 8px 0 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
}
.item-date,
.item-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

/* Индикатор обрезанного предпросмотра текста в копилке */
.item-date {
  display: flex;
  align-items: center;
}
.item-date.has-preview {
  cursor: pointer;
}
.item-date.has-preview:hover .saved-item-truncated-dot {
  filter: brightness(1.08);
}
.saved-item-truncated-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 7px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.48);
  border-radius: 50%;
  background: linear-gradient(145deg, #75ee8d 0%, #2fbf5b 48%, #147c35 100%);
  box-shadow:
    inset 1px 1px 1px rgba(255,255,255,.72),
    inset -1px -1px 1px rgba(0,0,0,.32),
    0 1px 2px rgba(0,0,0,.34);
  cursor: pointer;
  vertical-align: middle;
}
.saved-item-truncated-dot:hover {
  filter: brightness(1.08);
}
.saved-item-truncated-dot:focus-visible {
  outline: 2px solid rgba(255,255,255,.85);
  outline-offset: 2px;
}

/* Модальное окно просмотра полного текста из копилки */
.saved-item-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.38);
}
.saved-item-preview-panel {
  display: flex;
  flex-direction: column;
  width: min(860px, 96vw);
  max-height: 86vh;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-bg);
  box-shadow: 0 18px 42px rgba(0,0,0,.42), inset 0 1px 0 var(--inset);
  overflow: hidden;
}
.saved-item-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-dark);
  box-shadow: inset 0 1px 0 var(--line-light);
}
.saved-item-preview-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.saved-item-preview-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  font-size: 24px;
  line-height: 1;
}
.saved-item-preview-body {
  margin: 0;
  padding: 13px;
  overflow: auto;
  white-space: pre-line;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
  color: var(--text);
}

/* Модальное окно краткой справки приложения */
.app-info-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.38);
}
.app-info-panel {
  display: flex;
  flex-direction: column;
  width: min(620px, calc(100vw - 36px));
  height: min(620px, calc(100vh - 36px));
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-bg);
  box-shadow: 0 18px 42px rgba(0,0,0,.42), inset 0 1px 0 var(--inset);
  overflow: hidden;
}
.app-info-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 13px 8px;
  border-bottom: 1px solid var(--line-dark);
  box-shadow: inset 0 1px 0 var(--line-light);
  color: var(--text);
}
.app-info-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: .04em;
  font-family: "Marck Script Local", "Segoe Print", cursive;
  font-size: 29px;
  font-weight: 400;
}

/* Переключатель языка в окне инструкции */
.app-info-language-block {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-dark);
  box-shadow: inset 0 1px 0 var(--line-light);
}
.app-info-language-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.app-info-language-button {
  min-width: 92px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--button-top), var(--button-bottom));
  color: var(--text);
  box-shadow: 0 2px 4px rgba(0,0,0,.24), inset 0 1px 0 var(--inset);
  cursor: pointer;
}
.app-info-language-button.is-active {
  border-color: var(--accent-ok);
  color: var(--accent-ok);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.28), 0 0 0 1px rgba(63,127,85,.28);
}

.app-info-body {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-line;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
.app-info-ok {
  align-self: flex-end;
  min-width: 86px;
  margin: 0 13px 13px;
  padding: 8px 16px;
  border-radius: 8px;
}

/* Короткое всплывающее сообщение без переключения вкладок */
.app-toast {
  position: fixed;
  left: 50%;
  top: 96px;
  z-index: 2200;
  max-width: min(520px, calc(100vw - 32px));
  padding: 24px 36px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface-bg);
  box-shadow: 0 10px 24px rgba(0,0,0,.35), inset 0 1px 0 var(--line-light);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 8px);
  transition: opacity .16s ease, transform .16s ease;
}
.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.item-title { font-weight: 700; word-break: break-word; }

/* Индикатор отсутствующего физического файла */
.file-missing .item-title {
  color: var(--muted);
}
.file-missing-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid rgba(120, 70, 0, .45);
  border-radius: 999px;
  color: #5d3d00;
  background: rgba(255, 198, 91, .72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58);
  font-weight: 700;
}
.empty { padding: 16px; color: var(--muted); text-align: center; }
.file-upload-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 700;
}
.file-upload-button input { display: none; }
.sessions-list .ua { word-break: break-word; }



/* Панели действий справа от списков */
/* @llm-section:
purpose: moves selected-row actions into a right vertical panel without changing base button styling
invariant: side-actions-center actions target only the selected row; file upload remains an independent top action
*/
.side-list-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}
.list-content {
  min-width: 0;
}
.side-actions {
  min-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.side-actions-center {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: auto;
  margin-bottom: auto;
}
.side-upload-button {
  width: 40px;
  height: 36px;
  padding: 0;
  justify-content: center;
}
.list-item.is-selected {
  outline: 2px solid #f4f5f6;
  outline-offset: -3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.68), 0 3px 7px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.32);
}


/* Выбор цветовой темы */
.theme-settings-grid {
  display: grid;
  gap: 6px;
  max-width: 420px;
}
.theme-settings-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}
.theme-settings-grid select {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--field-border);
  padding: 7px 10px;
  color: var(--text);
  background: var(--input-bg);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.7);
}


/* Ссылка установки PWA */
.install-app-section {
  min-height: 0;
}
.install-app-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.install-app-link:visited {
  color: var(--text);
}
.install-app-link:focus-visible {
  outline: 2px solid rgba(255,255,255,.7);
  outline-offset: 3px;
}

/* Блок смены PIN */
.pin-change-grid {
  display: grid;
  gap: 10px;
  max-width: 420px;
}
.pin-change-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}
.pin-change-grid input {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--field-border);
  padding: 7px 10px;
  background: var(--input-bg);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.7);
}

/* Адаптация под маленькие экраны */
@media (max-width: 640px) {
  .shell { width: calc(100vw - 12px); margin: 6px auto; }
  .app-card { padding: 7px; }
  .topbar { align-items: center; flex-direction: row; gap: 6px; padding: 6px 7px 9px; }
  .panel-head { align-items: stretch; flex-direction: column; }
  .brand { align-self: auto; gap: 6px; font-size: 24px; }
  .brand-icon { width: 26px; height: 26px; }
  .app-info-title-text { font-size: 24px; }
  .service-status { gap: 4px; }
  .badge, .session-timer { min-width: 0; padding: 4px 6px; font-size: 12px; }
  .top-service-button { width: 30px; min-width: 30px; height: 26px; }
  .top-service-icon { width: 21px; height: 21px; }
  .badge { min-width: 58px; }
  .session-timer { min-width: 44px; }
  .icon-row { flex-wrap: wrap; }
  .icon-button { width: 44px; height: 40px; }
  .side-upload-button { width: 44px; height: 40px; }
  .side-list-layout { gap: 7px; }
  .session-actions { align-items: stretch; }
   textarea { min-height: calc(2 * 1.35em + 24px); height: 24vh; font-size: 15px; }
  .scroll-list { max-height: calc(100vh - 190px); }
  .auth-card { margin-top: 4vh; }
}
