:root {
  --bg: #f5f3f0;
  --panel: #ffffff;
  --ink: #221d1a;
  --muted: #736b66;
  --line: #e6e0da;
  --accent: #b83d14;
  --accent-ink: #ffffff;
  --accent-soft: #fbeae2;
  --warn: #b7791f;
  --danger: #b0243c;
  --danger-soft: #fbe9e7;
  --hl: #ffe9a8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(35, 22, 15, .06), 0 8px 24px rgba(35, 22, 15, .06);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412; --panel: #201c19; --ink: #ede8e4; --muted: #a39a93; --line: #35302c;
    --accent: #f08a5d; --accent-ink: #1d0f08; --accent-soft: #3d2216; --danger: #f2748b; --danger-soft: #3a2220;
    --hl: #5c4b17; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- бренд ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.logo { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 6px; background: var(--accent); border-radius: 7px; }
.logo i { display: block; width: 3px; border-radius: 2px; background: var(--accent-ink); }
.logo i:nth-child(1) { height: 6px } .logo i:nth-child(2) { height: 12px } .logo i:nth-child(3) { height: 16px }
.logo i:nth-child(4) { height: 10px } .logo i:nth-child(5) { height: 5px }

/* ---------- кнопки и поля ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 13px;
  cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger-ghost { color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input:not([type]), input[type=password], input[type=email], input[type=search], input[type=number], select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); outline: none;
}
input:focus, select:focus, [contenteditable]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
label input { margin-top: 5px; font-size: 15px; color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); margin: 0; }
label.check input { width: auto; margin: 0; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---------- вход ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); }
.auth-card .brand { font-size: 20px; }
.auth-sub { margin: 8px 0 20px; font-size: 14px; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tab { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

/* ---------- верхняя панель ---------- */
.topbar {
  height: 58px; display: flex; align-items: center; gap: 20px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.quota { margin-left: auto; width: 220px; font-size: 12px; color: var(--muted); }
.quota-text { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 4px; }
.quota-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
#quota-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.quota.warn #quota-fill { background: var(--warn); }
.quota.full #quota-fill { background: var(--danger); }
.quota.full { color: var(--danger); }
.user-menu, .export { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 20;
}
.dropdown > * {
  display: block; width: 100%; text-align: left; padding: 8px 11px; border: 0; background: none; border-radius: 7px;
  cursor: pointer; color: var(--ink); text-decoration: none; font-size: 14px;
}
.dropdown > *:hover { background: var(--accent-soft); }

/* ---------- страницы ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 24px 24px 80px; }
#job-view { max-width: 1200px; }
#detail-body.loading { opacity: .4; pointer-events: none; }
.back-btn { display: inline-block; margin: 0 0 12px -10px; text-decoration: none; color: var(--muted); }
.back-btn:hover { color: var(--accent); }

/* ---------- загрузка ---------- */
.upload-card { display: grid; grid-template-columns: 1fr 330px; gap: 14px; margin-bottom: 18px; }
.dropzone {
  display: flex; align-items: center; gap: 14px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; background: var(--panel); transition: border-color .15s, background .15s; outline: none;
}
.dropzone:hover, .dropzone:focus { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { color: var(--accent); flex-shrink: 0; }
.dz-title { font-weight: 600; }
.dz-sub { font-size: 13px; }
.upload-opts { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.upload-opts label.opt-cat { margin: 0; font-size: 12.5px; }
.upload-opts input { padding: 7px 10px; font-size: 14px; }
.diar-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.diar-opt select { width: auto; padding: 3px 6px; font-size: 13px; }
.diar-hint { flex-basis: 100%; font-size: 12px; line-height: 1.35; }

/* перетаскивание файла в любое место окна */
.drop-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(40, 22, 12, .55); display: grid; place-items: center;
  pointer-events: none; backdrop-filter: blur(2px);
}
.drop-box {
  background: var(--panel); border: 2px dashed var(--accent); border-radius: 18px; padding: 34px 46px; text-align: center;
  box-shadow: var(--shadow); min-width: 340px;
}
.drop-title { font-size: 20px; font-weight: 650; margin-top: 6px; }
.drop-sub { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* загрузки в процессе — плашки в углу, видны на любом экране */
.uploads { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 320px; display: flex; flex-direction: column; gap: 6px; }
.upload-item { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 13px; box-shadow: var(--shadow); position: relative; }
.upload-item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; padding-right: 18px; }
.upload-item.err { border-color: var(--danger); color: var(--danger); }
.upload-item.ok { border-color: var(--accent); }
.upload-item .x { position: absolute; right: 6px; top: 6px; border: 0; background: none; cursor: pointer; color: var(--muted); }
.upload-item.busy .x { display: none; }
.up-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.up-row .bar { flex: 1; margin: 0; }
.up-row .pct { font-size: 12px; min-width: 58px; text-align: right; }
.up-row .cancel { padding: 2px 8px; color: var(--danger); }
.up-note { font-size: 11.5px; margin-top: 3px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--danger); text-decoration: underline; cursor: pointer; font: inherit; }
.status-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; flex-wrap: wrap; }

/* ---------- говорящие ---------- */
.speakers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.spk-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 13px; cursor: pointer; color: var(--ink);
}
.spk-chip.all { padding-right: 10px; }
.spk-chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.spk-chip .share { color: var(--muted); font-size: 12px; }
.spk-chip .ren { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 13px; border-radius: 6px; }
.spk-chip .ren:hover { color: var(--accent); background: var(--accent-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.spk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin: 2px 0 1px -6px;
  border: 0; background: none; color: inherit; font-family: inherit; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.spk:hover { background: var(--accent-soft); }
.spk .caret { font-size: 10px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.spk:hover .caret, .tseg:hover .spk .caret { opacity: 1; }
.tbody { min-width: 0; }
.tbody .spk { display: flex; width: max-content; }
.ttext { cursor: text; border-radius: 4px; outline: none; }
.ttext:hover { box-shadow: 0 0 0 4px var(--panel); background: var(--panel); }
.tseg.current .ttext:hover { background: transparent; box-shadow: none; }
.tseg.editing { background: var(--panel); box-shadow: 0 0 0 1px var(--accent) inset; }
.tseg.editing .ttext { display: block; white-space: pre-wrap; background: transparent; box-shadow: none; }
.tseg.edited .tc::after { content: "✎"; margin-left: 4px; font-size: 10px; color: var(--accent); }
.tseg.with-spk { grid-template-columns: 64px 1fr 22px; }
.seg-spk { align-self: start; margin-top: 3px; width: 22px; height: 22px; border: 0; background: none; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.tseg:hover .seg-spk, .seg-spk:focus-visible { opacity: 1; }
.seg-spk:hover { background: var(--accent-soft); }
.spk-hint { flex-basis: 100%; font-size: 12px; margin-top: 2px; }
.edit-hint { margin-top: 16px; font-size: 12.5px; }
.spk-menu { position: absolute; z-index: 40; min-width: 220px; max-width: 300px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; font-size: 14px; }
.spk-menu .sm-title { font-size: 12px; color: var(--muted); padding: 4px 8px 6px; }
.spk-menu .sm-scope { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.spk-menu .sm-scope label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-size: 13px; cursor: pointer; }
.spk-menu .sm-scope input { width: auto; margin: 0; }
.spk-menu .sm-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; color: inherit;
  font: inherit; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.spk-menu .sm-item:hover { background: var(--accent-soft); }
.spk-menu .sm-item.cur { font-weight: 600; }
.spk-menu .sm-check { margin-left: auto; color: var(--accent); }
.spk-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.toast-act { margin-left: 12px; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
.tseg.spk-start { margin-top: 8px; }
.tseg[data-spk] { border-left: 3px solid var(--c); border-radius: 0 8px 8px 0; }
.turn { margin: 0 0 12px; }
.turn b { display: inline-flex; align-items: center; gap: 6px; }
.player { display: flex; align-items: center; gap: 10px; position: sticky; top: 58px; background: var(--bg); padding: 10px 0; z-index: 3; }
.player audio { flex: 1; height: 40px; }
.player select { width: auto; padding: 6px 8px; font-size: 13px; }
#owner-filter { font-size: 13px; }
.owner-tag { font-size: 12px; color: var(--accent); white-space: nowrap; }
.meta .owner { color: var(--accent); font-weight: 600; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--accent); transition: width .4s; }

/* ---------- список ---------- */
.list-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar input[type=search] { flex: 1 1 260px; width: auto; }
.toolbar select { flex: 0 1 auto; width: auto; max-width: 240px; }
.list-head { font-size: 12.5px; color: var(--muted); padding: 2px 4px 6px; }
.job {
  --pad: calc(12px + var(--lvl, 0) * 22px);
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px var(--pad); border-radius: 9px;
  text-decoration: none; color: var(--ink); border: 1px solid transparent;
}
.job:hover { background: var(--bg); border-color: var(--line); }
.job-main { flex: 1; min-width: 0; }
.job-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: center; }
.job-snippet { font-size: 13px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.job .badge { margin-top: 2px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.badge.done { background: transparent; color: var(--muted); padding: 2px 0; }
.badge.processing, .badge.queued { background: var(--accent-soft); color: var(--accent); }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.cat-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); opacity: .75; }
.empty { text-align: center; padding: 36px 0; }
mark { background: var(--hl); color: inherit; border-radius: 3px; padding: 0 1px; }

/* иконки: файл (аудио/видео) и папка — чистый CSS, без картинок */
.folder-ico { width: 18px; height: 14px; flex-shrink: 0; position: relative; display: inline-block; background: #d9a441; border-radius: 2px 3px 3px 3px; margin-top: 2px; }
.folder-ico::before { content: ""; position: absolute; left: 0; top: -3px; width: 8px; height: 4px; background: #d9a441; border-radius: 2px 2px 0 0; }
.cat-tag .folder-ico { width: 13px; height: 10px; margin-top: 1px; }
.cat-tag .folder-ico::before { width: 6px; height: 3px; top: -2px; }

/* папки */
.folder-head {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
  padding: 9px 12px 9px calc(12px + var(--lvl, 0) * 22px); border-radius: 9px; font-weight: 600; color: var(--ink);
}
.folder-head:hover { background: var(--bg); }
.chev { width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; flex-shrink: 0; }
.folder.open > .folder-head .chev { transform: rotate(90deg); }
.fname { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcount { font-weight: 500; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 1px 8px; }
.folder-body { display: none; }
.folder.open > .folder-body { display: block; }
.loose-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 14px 12px 4px; }

/* ---------- просмотр ---------- */
.cat-edit { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; max-width: 520px; }
.cat-edit input { border-color: transparent; background: transparent; padding: 5px 8px; font-size: 14px; }
.cat-edit input:hover { border-color: var(--line); background: var(--panel); }
.cat-edit input:focus { background: var(--panel); }
.detail-head { display: flex; align-items: flex-start; gap: 16px; }
.detail-head h1 { flex: 1; font-size: 24px; line-height: 1.25; margin: 0; padding: 2px 6px; margin-left: -6px; border-radius: 7px; border: 1px solid transparent; letter-spacing: -.015em; }
.detail-head h1:hover { border-color: var(--line); }
.detail-actions { display: flex; gap: 6px; flex-shrink: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; margin: 8px 0 18px; }
.status-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.status-box.error { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.status-box .bar { height: 6px; margin-top: 12px; }
.view-toggle { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; }
.seg { border: 1px solid var(--line); background: var(--panel); padding: 6px 12px; cursor: pointer; font-size: 13px; }
.seg:first-of-type { border-radius: 8px 0 0 8px; } .seg:nth-of-type(2) { border-radius: 0 8px 8px 0; margin-left: -5px; }
.seg.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.view-toggle input { width: 220px; margin-left: auto; padding: 6px 10px; font-size: 13px; }
.transcript { max-width: 860px; font-size: 16px; line-height: 1.7; }
.transcript .plain { white-space: pre-wrap; }
.tseg { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 6px 10px; margin: 0 -10px; border-radius: 8px; }
.tseg:hover { background: var(--panel); }
.tseg.current { background: var(--accent-soft); }
.tseg .tc { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 4px; user-select: none; }
.tseg.has-audio .tc { cursor: pointer; }
.tseg.has-audio .tc:hover { color: var(--accent); }

/* ---------- диалоги ---------- */
dialog { border: 0; border-radius: 16px; padding: 24px; width: min(420px, 92vw); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
dialog.wide { width: min(920px, 95vw); }
dialog::backdrop { background: rgba(20, 12, 8, .45); }
dialog h2 { margin: 0 0 16px; font-size: 19px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.admin-status { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); margin: 14px 0; padding: 12px 14px; background: var(--bg); border-radius: 10px; }
.admin-status b { color: var(--ink); font-weight: 600; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.users td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users input[type=number] { width: 90px; padding: 5px 7px; }
.ok { color: var(--accent); } .bad { color: var(--danger); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw;
}
.toast.err { background: var(--danger); color: #fff; }

/* ---------- мобильные ---------- */
@media (max-width: 860px) {
  .page { padding: 16px 12px 80px; }
  .upload-card { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; }
  .quota { width: 120px; }
  .app-name { display: none; }
  .toolbar select { flex: 1 1 45%; max-width: none; }
  .uploads { left: 12px; right: 12px; width: auto; }
  .job { --pad: calc(8px + var(--lvl, 0) * 14px); }
  .folder-head { padding-left: calc(8px + var(--lvl, 0) * 14px); }
}
.domain-hint { font-size: 12.5px; margin: -6px 0 12px; }
.admin-tabs { max-width: 520px; }
.admin-tabs .tab { white-space: nowrap; }
.users-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.table-wrap { max-height: 55vh; overflow: auto; }
.domain-form { display: grid; grid-template-columns: 220px 1fr auto; gap: 8px; margin: 12px 0 14px; }
.small-text { font-size: 13px; margin: 0; }
code { font-family: var(--mono); font-size: .92em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.pill { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.mini-bar { height: 4px; width: 110px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.mini-bar > div { height: 100%; background: var(--accent); }
.mini-bar.full > div { background: var(--danger); }
.user-usage { font-size: 13px; margin: 12px 0 4px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }
@media (max-width: 700px) { .domain-form { grid-template-columns: 1fr; } }

/* подтверждение почты */
.verify-title { font-size: 18px; margin: 4px 0 6px; }
.verify-sub { font-size: 14px; margin: 0 0 16px; }
.code-input { font-size: 24px !important; letter-spacing: 8px; text-align: center; font-family: var(--mono); }
.verify-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.linkbtn.plain { color: var(--accent); }
.linkbtn:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.admin-status .linkbtn.plain { font-size: 13px; }

/* логотип компании на странице входа */
.brand-logo { height: 46px; width: auto; border-radius: 6px; display: block; }
.auth-card .brand { gap: 14px; }

.check-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
#replace-form label.check { margin-bottom: 10px; font-size: 14px; }
.replace-count { font-size: 13px; min-height: 18px; margin-bottom: 4px; }
#dict-dialog .tabs { margin: 12px 0 10px; max-width: 540px; }
#dict-dialog .tab { white-space: nowrap; }
#dict-text { width: 100%; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg); color: var(--ink); resize: vertical; outline: none; }
#dict-text:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#dict-text[readonly] { opacity: .8; }
.dict-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.dict-foot .form-error { flex: 1; margin: 0; }

/* ---------- текст + боковая панель поиска ---------- */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; align-items: start; }
.reader-main { min-width: 0; padding-bottom: 35vh; } /* запас снизу: последнее совпадение тоже встаёт по центру, панель не уезжает */
.text-tools { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 92px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tt-search input { padding: 7px 10px; font-size: 14px; }
.tt-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; font-size: 13px; }
.tt-nav #hit-count { flex: 1; text-align: center; white-space: nowrap; min-width: 64px; }
/* плеер тоже прилипает к верху (высота 60px) — панель встаёт под него */
#player:not(.hidden) ~ .reader .text-tools { top: 130px; max-height: calc(100vh - 148px); }
.tt-arrow { width: 34px; height: 28px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1; }
.tt-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.tt-arrow:disabled { opacity: .4; cursor: default; }
.tt-hits { overflow-y: auto; min-height: 0; flex: 1 1 auto; margin: 0 -6px; }
.tt-hits:empty { display: none; }
.hit { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; font-size: 13px; line-height: 1.45;
  padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.hit:hover { background: var(--accent-soft); }
.hit.cur { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.hit .ht { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-right: 6px; }
.hit b { color: var(--accent); font-weight: 600; }
.tt-more { font-size: 12px; padding: 4px 8px; }
.tt-actions { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.tt-actions .btn { width: 100%; }
#transcript mark { border-radius: 3px; }
#transcript mark.cur { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 1100px) {
  .reader { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .text-tools { order: -1; top: 58px; z-index: 4; max-height: none; flex-direction: row; flex-wrap: wrap; align-items: center;
    border-radius: 0 0 var(--radius) var(--radius); margin: 0 -12px 12px; box-shadow: var(--shadow); }
  .tt-search { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; }
  .tt-nav { margin: 0; }
  #player:not(.hidden) ~ .reader .text-tools { top: 118px; max-height: none; }
  .tt-hits { display: none; }
  .tt-actions { flex-direction: row; border: 0; padding: 0; }
  .tt-actions .btn { width: auto; }
}

/* ---------- словари пользователей ---------- */
.dict-users { margin-top: 4px; }
.du-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.du-tools input[type=search] { flex: 1 1 260px; padding: 7px 10px; font-size: 14px; }
.du-tools label.check { font-size: 13px; }
.du-list { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.du-user { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.du-head { font-size: 14px; margin-bottom: 6px; }
table.du-rules { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.du-pat { width: 34%; } .du-rep { width: auto; } .du-act { width: 230px; }
table.du-rules td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
table.du-rules tr:first-child td { border-top: 0; }
.du-pat, .du-rep { font-family: var(--mono); font-size: 13px; }
.du-arrow { color: var(--muted); width: 24px; text-align: center; }
.du-act { text-align: right; white-space: nowrap; }
.du-pat, .du-rep { overflow-wrap: anywhere; }
.du-in { color: var(--accent); font-size: 13px; }
.du-note { font-size: 11.5px; margin-top: 2px; }
