/* ASR v3 - ağ/qara, monospace interfeys.
   Şrift yığını opencode.ai-dəki ilə eynidir: Berkeley Mono lisenziyalıdır, ona
   görə real yüklənən IBM Plex Mono-dur (latin + latin-ext, `ə ğ ı ş ö ü ç` daxil). */

@import url("fonts/plex-mono.css");

:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --raised: #f2f2f2;
  --border: #e2e2e2;
  --border-strong: #c9c9c9;
  --text: #111111;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --invert-bg: #111111;
  --invert-text: #ffffff;
  /* Loqo mətndən bir az kontrastlıdır - nişan solğun görünməsin */
  --logo-color: #000000;
  --font: "Berkeley Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius: 2px;
  /* Mətn sahələrində seçim rəngi: sahənin fonundan fərqli boz (ağ/qara tərs yox) */
  --select-bg: #c9d4e3;
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Brauzerin öz elementləri (avtomatik doldurma, scrollbar, select) də tünd olsun */
  color-scheme: dark;
  --select-bg: #3d4a5c;
  --bg: #0b0b0b;
  --panel: #111111;
  --raised: #191919;
  --border: #262626;
  --border-strong: #3d3d3d;
  --text: #e8e8e8;
  --muted: #8c8c8c;
  --faint: #5f5f5f;
  --invert-bg: #ffffff;
  --invert-text: #0b0b0b;
  --logo-color: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: var(--invert-bg); color: var(--invert-text); }

/* ---------- ümumi elementlər ---------- */

.label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

button, .btn {
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

button:hover, .btn:hover { background: var(--raised); }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:disabled:hover { background: transparent; }

.btn-primary {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-color: var(--invert-bg);
}

.btn-primary:hover { opacity: 0.85; background: var(--invert-bg); }

.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

.btn-sm { padding: 3px 8px; font-size: 11px; }

input, textarea, select {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  width: 100%;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--text);
}

input::placeholder { color: var(--faint); }

/* Seçilmiş mətn sahənin içində görünsün: ümumi ::selection (ağ/qara tərs) qara
   mövzuda ağ fon verirdi və brauzerin ağ "avtomatik doldurma" fonu ilə birləşib
   seçim görünmürdü (login-də istifadəçi adı). */
input::selection, textarea::selection { background: var(--select-bg); color: var(--text); }

/* Brauzer yadda saxlanmış login-i dolduranda sahəni öz rəngi ilə (ağ/sarı) boyayır -
   qara mövzuda ağ sahə alınırdı. Fon mövzunun rənginə qaytarılır. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
input:autofill { background: var(--bg); color: var(--text); }

hr { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ---------- karkas ---------- */

.shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Heç bir iç element səhifəni eninə genişləndirməsin - lazım olanda
     öz daxilində scroll olunur (cədvəl: .table-wrap) */
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* Loqo SVG-si maska kimi işlədilir: rəngi `currentColor`-dan alır, ona görə
   eyni fayl həm ağ, həm qara mövzuda düzgün görünür. */
/* 64 px-lik başlıq zolağında ~60% hündürlük: yazı ilə tarazdır, zolağı doldurmur */
.brand .logo {
  width: 38px;
  height: 38px;
  flex: none;
  background: var(--logo-color);
  /* Loqo dəyişəndə `?v=` artırılır - nginx statikanı 7 gün keşləyir, yoxsa
     istifadəçidə köhnə nişan qalır. */
  -webkit-mask: url("logo.svg?v=6") center / contain no-repeat;
  mask: url("logo.svg?v=6") center / contain no-repeat;
}

.brand .logo.lg { width: 64px; height: 64px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.chip {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 8px;
  white-space: nowrap;
}

.body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ---------- sol panel ---------- */

.sidebar {
  width: 280px;
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: width 0.18s ease;
}

/* ☰ ilə bağlanmış panel: əsas sahə tam enliyə keçir */
body.sb-collapsed .sidebar {
  width: 0;
  border-right: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* seçim rejimi */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--raised);
}

.bulk-bar .danger,
.btn.danger {
  color: var(--danger, #e5484d);
}

.file-item { display: flex; align-items: center; gap: 8px; }

.file-item.selected { background: var(--raised); box-shadow: inset 2px 0 0 var(--accent, currentColor); }

.file-check {
  flex: none;
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #4f8cff);
  cursor: pointer;
}

.file-name { flex: 1; min-width: 0; }

#selectBtn.on {
  background: var(--accent, #4f8cff);
  color: #fff;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.file-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.file-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: block;
  position: relative;
}

.file-item:hover { background: var(--raised); }

/* Silmə düyməsi yalnız kursor sətrin üstündə olanda görünür */
.file-del {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: var(--raised);
}

.file-item:hover .file-del { opacity: 1; }

/* Sağ kənarda yer yoxdur - ipucu sola açılır.
   İki sinif birlikdə yazılıb ki, faylda sonra gələn `.hint::after` qaydası
   `left`-i geri qaytarmasın: eyni çəkidə olsaydı, `left` və `right` birlikdə
   təyin olunub ipucunun eni sıfıra düşürdü. */
.hint.hint-left::after {
  left: auto;
  right: calc(100% + 8px);
}

.file-item.active {
  background: var(--raised);
  box-shadow: inset 2px 0 0 var(--text);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.file-meta {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: var(--faint);
  margin-top: 2px;
}

.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  vertical-align: middle;
}

.dot.live { background: var(--text); animation: pulse 1s infinite; }
.dot.err { background: var(--text); opacity: 0.5; }

@keyframes pulse { 50% { opacity: 0.25; } }

/* ---------- əsas sahə ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.main-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

/* Panel düyməsi alətlər sətrinin ən solunda, sabit ölçüdə */
.main-head #sidebarToggle { flex: none; }

/* Ox panelin vəziyyətini göstərir: AÇIQ -> sola (bağla), BAĞLI -> sağa (aç).
   SVG-nin özü sola baxır, bağlı vəziyyətdə 180° çevrilir. */
.sb-toggle {
  padding: 4px 7px;
  line-height: 0;
}

.sb-toggle svg {
  width: 13px;
  height: 13px;
  display: block;
  transition: transform 0.18s ease;
}

body.sb-collapsed .sb-toggle svg { transform: rotate(180deg); }

.main-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 24px 20px 32px;
}

.center {
  max-width: 760px;
  margin: 0 auto;
}

/* ---------- giriş paneli ---------- */

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
}

.dropzone:hover, .dropzone.over {
  border-color: var(--text);
  color: var(--text);
  background: var(--panel);
}

.dropzone .big { font-size: 14px; color: var(--text); margin-bottom: 6px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.row { display: flex; gap: 8px; }

/* .row içindəki mətn sahələri 100% eni məcbur etmir - düymə ilə birlikdə
   sığaraq üfüqi scroll yaratmır */
.row > input:not([type="checkbox"]):not([type="radio"]) {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.notice {
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 14px 0;
  font-size: 12px;
  background: var(--panel);
}

/* ---------- transkript ---------- */

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 14px;
  min-height: 18px;
}

.progress {
  flex: 1;
  height: 2px;
  background: var(--border);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--text);
  transition: width 0.25s;
}

.transcript {
  font-size: 15px;
  line-height: 2.05;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Sətir: solda alət sütunu (redaktə düymələri), sağda vaxt + mətn */
.cue {
  margin-bottom: 14px;
  position: relative;
  padding-left: 30px;
}

.cue-tools {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}

/* Yalnız kursor sətrin üstündə olanda görünür - mətn təmiz qalsın */
.cue:hover .cue-tools,
.cue.editing .cue-tools { opacity: 1; }

.icon-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  justify-content: center;
  border-color: transparent;
  color: var(--faint);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-btn svg { width: 13px; height: 13px; display: block; }

.cue-time {
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
}

.cue-time:hover { color: var(--text); }

/* İpucu: sağ tərəfdə açılır, çünki sol kənarda yer yoxdur və yuxarıda
   sürüşən sahə onu kəsir. */
.hint::after {
  content: attr(data-hint);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 10px;
  line-height: 1.5;
  padding: 3px 7px;
  border-radius: var(--radius);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 20;
}

.hint:hover::after { opacity: 1; }

.w {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 1px 1px;
  transition: background 0.08s;
}

.w:hover {
  background: var(--raised);
  box-shadow: 0 1px 0 var(--text);
}

.w.on {
  background: var(--invert-bg);
  color: var(--invert-text);
}

.transcript.raw { color: var(--muted); }

/* Redaktə rejimi sətir-sətirdir: yalnız seçilmiş sətir dəyişdirilə bilir,
   sözlərin vaxt möhürləri isə yerində qalır. */
.cue.editing .cue-line {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  outline: none;
  background: var(--panel);
}

.cue.editing .w { cursor: text; }

.cue.editing .w:hover {
  background: transparent;
  box-shadow: none;
}

.cue.editing .w.on {
  background: transparent;
  color: inherit;
}

.cue.editing .cue-time {
  pointer-events: none;
  opacity: 0.45;
}

.empty {
  color: var(--faint);
  text-align: center;
  padding: 60px 0;
  font-size: 12px;
}

/* ---------- pleyer ---------- */

.player {
  flex: none;
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.player audio { width: 100%; height: 32px; }

.player .time { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- modal ---------- */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.modal h3 { margin: 0 0 14px; font-size: 13px; font-weight: 600; }

.dialog-text {
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.modal input { margin-top: 12px; }

.kv {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.kv span:first-child { color: var(--muted); }

/* API sənəd səhifəsi: mətn sütunu mərkəzdə, uzun kod blokları öz içində sürüşür.

   `display: block` VACİBDİR: bu element həm də `.main`-dir, ora isə
   `display: flex; flex-direction: column` verilib. Flex sütununda məzmun
   hündürlüyü aşanda uşaqlar sıxılır - cədvəl qutuları 0 hündürlüyə düşüb
   məzmunu bir-birinin üstünə salırdı. */
.api-page {
  display: block;
  width: 100%;
  /* Sürüşən qutu TAM enlidir: şaquli scroll pəncərənin sağ kənarında olur.
     Əvvəl `max-width: 900px` burada idi və scroll zolağı səhifənin ortasında,
     mətn sütununun kənarında görünürdü. */
  overflow-y: auto;
  min-width: 0;
}

/* Mətn sütunu sürüşən qutunun içində mərkəzləşir */
.api-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.api-page p { margin: 0 0 10px; line-height: 1.75; }
.api-page code { font-size: 11px; }

.api-h1 { font-size: 20px; margin: 0 0 6px; font-weight: 600; }
.api-page .lead { color: var(--muted); margin-bottom: 4px; }

/* Nömrələnmiş addım başlıqları - sənəd sıra ilə oxunur */
.api-h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  margin: 44px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.step-num {
  flex: none;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border-radius: 50%;
  background: var(--invert-bg);
  color: var(--invert-text);
}

.api-page h3 { font-size: 12px; margin: 26px 0 8px; color: var(--muted); }

/* Vurğulanan qeyd */
.note {
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 12px;
  line-height: 1.7;
}

/* Python / curl keçidi */
.code-tabs { margin-top: 10px; }

.tabs-row { display: flex; gap: 2px; }

.tabs-row .tab {
  border: none;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius);
}

.tabs-row .tab:hover { color: var(--text); background: transparent; }

.tabs-row .tab.on {
  color: var(--invert-text);
  background: var(--invert-bg);
}

.code-tabs .api-code {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}

.api-key-list {
  margin-top: 12px;
  max-height: 40vh;
  overflow-y: auto;
  /* İçəridəki ipucu qutuları sətrin sağına daşıb səhifəni genişlətməsin */
  overflow-x: hidden;
}

.api-key-list code {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  opacity: 0.85;
}

.api-code {
  background: var(--bg-soft, rgba(128, 128, 128, 0.12));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

.code-block { margin-top: 8px; }

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--raised);
  font-size: 11px;
  color: var(--muted);
}

.code-block .api-code {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}

/* Kod sətirləri səhifəni genişləndirməsin - uzun sətirlər alt sətirə keçir */
.api-code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: hidden;
}

.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

/* Dar ekranlarda cədvəl səhifəni deyil, özünü genişləndirir.
   `min-width: 0` olmasa flex valideyn içində qutu daralmır və cədvəl kəsilir. */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
}

/* Cədvəl sətirləri dar ekranda əzilməsin - qutu sürüşsün */
.table-wrap > table { min-width: 520px; }

.api-table th, .api-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.api-table th {
  font-weight: 600;
  color: var(--muted);
}

.api-table code {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
}

.modal .dialog-text code {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bg-soft, rgba(128, 128, 128, 0.15));
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* Çat: "paylaş" pəncərəsi - link sahəsi və kopyala düyməsi bir sətirdə */
.share-modal { max-width: 480px; }
.share-link { display: flex; gap: 8px; margin-top: 12px; }
.share-link input { margin-top: 0; flex: 1; min-width: 0; font-size: 12px; }
.share-link .btn { flex: none; }
.share-modal .modal-actions { flex-wrap: wrap; }

/* Yükləmə göstəricisi. Faylda faiz bilinir, linkdə isə bilinmir - o halda
   zolaq gedər-gəlməz hərəkət edir ki, gözləmə donmuş görünməsin. */
.bar {
  height: 2px;
  background: var(--border);
  margin-top: 16px;
  overflow: hidden;
  position: relative;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--text);
  transition: width 0.15s linear;
}

.bar.indeterminate > i {
  width: 35%;
  animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

.bar-label {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

/* ---------- auth / admin ---------- */

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  background: var(--panel);
}

.auth-card h1 {
  font-size: 15px;
  margin: 0 0 4px;
  letter-spacing: 0.06em;
}

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 5px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; }

.tabs button { flex: 1; justify-content: center; }

.tabs button.on {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-color: var(--invert-bg);
}

table { width: 100%; border-collapse: collapse; font-size: 12px; }

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
}

tbody tr:hover { background: var(--panel); }

.err {
  font-size: 11px;
  border: 1px solid var(--border-strong);
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: var(--radius);
}

.hidden { display: none !important; }

/* ---------- mobil ---------- */

/* Fon örtüyü və bağlama düyməsi yalnız mobil çekmecədə lazımdır */
.sb-backdrop { display: none; }
.sb-close { display: none; }

@media (max-width: 860px) {
  /* Panel məzmunu aşağı itələmir: üstünə sürüşən çekmecə kimi açılır.
     Əvvəl `position: static` idi və fayl siyahısı ekranın üçdə birini tutub
     transkripti aşağı salırdı. */
  .sidebar {
    position: fixed;
    z-index: 45;
    top: 0;
    left: 0;
    bottom: 0;
    width: 86%;
    max-width: 320px;
    max-height: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
  }

  body:not(.sb-collapsed) .sidebar { transform: none; }

  /* Bağlı vəziyyətdə eni saxlanılır (masaüstündəki `width: 0` mobil üçün
     lazım deyil) - yalnız ekrandan kənara sürüşür */
  body.sb-collapsed .sidebar { width: 86%; }

  .sb-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body:not(.sb-collapsed) .sb-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sb-close { display: inline-flex; }

  .main-body { padding: 16px 14px 24px; }
  .topbar { padding: 0 12px; }
  .topbar-right .hide-sm { display: none; }
}

/* Dar ekranlarda topbar iki sətirə keçir: 1-ci sətir ☰ + marka, 2-ci sətir
   sağdakı düymələr - beləcə heç nə üst-üstə düşmür, hər şey sığır */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 8px 10px; height: auto; flex-wrap: wrap; }
  .brand-sub { display: none; }
  .topbar-left { flex: 1 1 auto; min-width: 0; }
  .brand { min-width: 0; }
  .brand-text { min-width: 0; }
  .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { flex: 1 1 100%; justify-content: flex-end; }
  .topbar-right .chip {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- ASR / TTS keçidi ---------- */

.mode-switch {
  display: inline-flex;
  flex: none;
  margin-left: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.mode-switch a {
  padding: 3px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--muted);
}

.mode-switch a:hover { color: var(--text); background: var(--raised); }

.mode-switch a.on {
  background: var(--invert-bg);
  color: var(--invert-text);
}

/* ---------- TTS ---------- */

.tts-form { display: flex; flex-direction: column; gap: 18px; }

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.check input { width: auto; margin: 0; accent-color: var(--text); }

.dropzone.compact { padding: 22px 16px; }

.dropzone.has-file {
  border-style: solid;
  color: var(--text);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.dropzone.has-file .big {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.ref-preview { margin-top: 8px; width: 100%; height: 32px; }

textarea { resize: vertical; line-height: 1.7; min-height: 70px; }

textarea:disabled { opacity: 0.6; }

.counter { font-size: 10px; color: var(--faint); letter-spacing: 0.06em; }
.counter.over { color: var(--text); font-weight: 600; }

details.adv summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  list-style: none;
}

details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: "+ "; }
details.adv[open] summary::before { content: "− "; }

.adv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.adv-grid .label { display: block; margin-bottom: 5px; }

.gen-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gen-row .btn-primary { padding: 9px 22px; font-size: 13px; }
.gen-row .muted, .muted { color: var(--muted); font-size: 11px; }

/* Nəticə: dalğa forması + idarə */
.tts-out {
  margin-top: 26px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 14px 16px;
}

.tts-out .status-line { margin-bottom: 0; }
.tts-out.has-audio .status-line { margin-bottom: 12px; }

.wave-wrap { position: relative; height: 80px; cursor: pointer; }
.wave-wrap canvas { width: 100%; height: 100%; display: block; }

.wave-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.wave-ctrl .play { min-width: 64px; justify-content: center; }
.wave-ctrl .spacer { flex: 1; }

.progress.indeterminate > i {
  width: 30%;
  animation: slide 1.1s ease-in-out infinite;
}

.tts-text-preview {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 7.5em;
  overflow: hidden;
}

@media (max-width: 600px) {
  .mode-switch { margin-left: 8px; }
}

/* ---------- TTS: səs bazası ---------- */

.voice-current {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--panel);
}

.vinfo { flex: 1; min-width: 0; }

.vname {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vmeta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: 1px;
}

.icon-btn.vplay {
  flex: none;
  width: 28px;
  height: 28px;
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-btn.vplay.on { background: var(--invert-bg); color: var(--invert-text); }

.voice-lib {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.voice-lib-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.voice-lib:not(.open) .voice-lib-head { border-bottom: none; }

.lib-toggle {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  gap: 8px;
  border: none;
  padding: 2px 0;
  background: transparent;
}

.lib-toggle:hover { background: transparent; }
.lib-toggle:hover .label { color: var(--text); }
.lib-toggle .label { white-space: nowrap; }

.lib-toggle svg {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.voice-lib.open .lib-toggle svg { transform: rotate(90deg); }
.voice-lib-head input { width: 160px; padding: 4px 8px; font-size: 12px; }

.voice-list { max-height: 264px; overflow-y: auto; }

.voice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.voice-item:last-child { border-bottom: none; }
.voice-item:hover { background: var(--raised); }
.voice-item.active { background: var(--raised); box-shadow: inset 2px 0 0 var(--text); }

.voice-item .vdur { font-size: 11px; color: var(--faint); flex: none; }

.vactions { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity 0.12s; }
.voice-item:hover .vactions, .voice-item:focus-within .vactions { opacity: 1; }
.vactions .icon-btn.on { color: var(--text); border-color: var(--border-strong); }

.voice-list .empty { padding: 22px 0; }

@media (max-width: 860px) {
  .vactions { opacity: 1; }
}

@media (max-width: 600px) {
  .voice-lib-head input { width: 110px; }
  .voice-item .vdur { display: none; }
}

.dropzone.busy { opacity: 0.7; pointer-events: none; }
.dropzone.busy .big { animation: pulse 1s infinite; }

/* ---------- Conversational AI (çat) ---------- */

.chat-empty { text-align: center; padding: 72px 0 24px; }
.chat-empty .muted { max-width: 48ch; margin: 0 auto; line-height: 1.7; }
.chat-empty-title { font-size: 18px; font-weight: 600; margin-bottom: 10px; }

.suggest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
}

.suggest .btn { font-size: 12px; color: var(--muted); }
.suggest .btn:hover { color: var(--text); }

.chat-thread { padding-bottom: 8px; }

.msg { margin: 0 0 22px; }

.msg.user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.msg.user .bubble {
  max-width: 85%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-note { font-size: 10px; letter-spacing: 0.08em; color: var(--faint); margin-top: 4px; }

.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}

.msg.ai:hover .msg-actions, .msg.ai:last-child .msg-actions { opacity: 1; }
.msg-actions .btn { padding: 2px 6px; font-size: 10px; }

/* Cavab hələ yazılır: son elementin sonunda yanıb-sönən kursor */
/* Üç nöqtə (gözləmə) ilə yanaşı kursor görünməsin - kursor yalnız mətn yazılanda */
.msg.ai.streaming .md > :last-child:not(.typing)::after {
  content: "▍";
  margin-left: 1px;
  animation: pulse 1s infinite;
}

.typing { display: inline-flex; gap: 4px; padding: 8px 0; }

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 1s infinite;
}

.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }

/* Markdown */
.md { font-size: 14px; line-height: 1.75; word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 18px 0 8px; line-height: 1.4; font-weight: 600; }
.md h1 { font-size: 17px; }
.md h2 { font-size: 16px; }
.md h3, .md h4, .md h5, .md h6 { font-size: 14px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md hr { margin: 14px 0; }

.md blockquote {
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}

.md code {
  font-family: var(--font);
  font-size: 12px;
  background: var(--raised);
  border-radius: var(--radius);
  padding: 1px 5px;
}

.md pre {
  position: relative;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
}

.md pre code { background: none; padding: 0; white-space: pre; }

.md-lang {
  display: block;
  margin-bottom: 6px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.md-table { overflow-x: auto; margin: 0 0 12px; }
.md table { width: auto; min-width: 50%; }
.md th, .md td { padding: 6px 10px; border: 1px solid var(--border); }
.md th { font-size: 11px; letter-spacing: 0.04em; text-transform: none; color: var(--muted); font-weight: 600; }

/* Yazı sahəsi */
.composer {
  flex: none;
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 12px 20px 8px;
}

.composer-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.composer textarea {
  flex: 1;
  width: 100%;
  min-height: 42px;
  max-height: 220px;
  resize: none;
  font-size: 14px;
  line-height: 1.6;
}

.composer .btn { height: 42px; flex: none; justify-content: center; min-width: 92px; }

/* "AI səhv edə bilər" xəbərdarlığı - mobildə də görünür */
.composer-hint {
  max-width: 760px;
  margin: 5px auto 0;
  font-size: 10px;
  color: var(--faint);
  text-align: center;
}

@media (max-width: 600px) {
  .composer { padding: 10px 10px 6px; }
  .msg.user .bubble { max-width: 92%; }
  .msg-actions { opacity: 1; }
}

/* ---------- çat: səs və mikrofon ---------- */

.icon-tool {
  height: 42px;
  min-width: 42px;
  padding: 0 10px;
  justify-content: center;
  flex: none;
  color: var(--muted);
}

.icon-tool svg { width: 18px; height: 18px; display: block; }
.icon-tool:hover { color: var(--text); }


/* Mikrofon: dəyirmi düymə. Yazarkən ikon gizlənir, yerində ekvalayzer
   zolaqları səsin tezliklərinə görə böyüyüb-kiçilir (JS --h dəyişənini verir). */
#micBtn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  flex: none;
}

#micBtn.rec {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-color: var(--invert-bg);
}

#micBtn .eq { display: none; align-items: center; justify-content: center; gap: 2.5px; height: 22px; }
#micBtn.rec .mic-icon { display: none; }
#micBtn.rec .eq { display: flex; }

#micBtn .eq i {
  --h: 0;
  width: 3px;
  height: calc(3px + var(--h) * 19px);
  border-radius: 2px;
  background: currentColor;
  transition: height 60ms linear;
}

#micBtn.busy { opacity: 0.5; pointer-events: none; }

.msg.ai.speaking .msg-actions { opacity: 1; }
.msg-actions .audio-btn { padding: 2px 6px; }
.msg-actions .audio-btn svg { width: 13px; height: 13px; display: block; }
.msg-actions .audio-btn.on { color: var(--text); border-color: var(--border-strong); }
.composer .icon-tool { min-width: 42px; padding: 0 10px; }
#micBtn.unavail { opacity: 0.45; }

.msg-sources { font-size: 12.5px; line-height: 1.6; color: var(--faint); margin-top: 8px; letter-spacing: 0.01em; }
.msg-sources a { color: var(--muted); }
.msg-sources a:hover { color: var(--text); }

/* Yazı qutusu: [mikrofon | mətn | fayl] bir çərçivədə. Düymələr kvadratdır, mətndən
   xətt ilə ayrılır; mətn uzananda ikonlar aşağıda (son sətrin yanında) qalır.
   Səslə yazılmış mətni silən × mətn sahəsinin sağ yuxarı küncündədir. */
.input-wrap {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.input-wrap:focus-within { border-color: var(--text); }
.input-field { position: relative; flex: 1; display: flex; min-width: 0; }
.composer .input-field textarea { flex: 1; width: 100%; min-height: 40px; border: none; background: transparent; }
.input-wrap.has-clear textarea { padding-right: 32px; }
/* Uzun yer tutucu (Banx) dar ekranda ikinci sətrə düşüb kəsilməsin */
.composer .input-field textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.composer .input-wrap .icon-tool,
.composer .input-wrap #micBtn {
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: auto;
  min-height: 40px;
  padding: 0 0 10px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.composer .input-wrap #micBtn { border-right: 1px solid var(--border); }
.composer .input-wrap #attachBtn { border-left: 1px solid var(--border); }
.composer .input-wrap .icon-tool:hover { background: var(--raised); }
.composer .input-wrap #micBtn .eq { height: 20px; }
.composer .input-wrap #micBtn.rec { background: var(--invert-bg); color: var(--invert-text); }

.clear-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--raised);
  color: var(--muted);
}

.clear-btn:hover { color: var(--text); background: var(--border); }
.clear-btn svg { width: 11px; height: 11px; display: block; }

/* Agent alət işlədərkən üç nöqtənin yanında status */
.tool-status { margin-left: 10px; font-size: 11px; color: var(--muted); animation: pulse 1.4s infinite; }

/* Cavabın altındakı ikon düymələr (kopyala, yenidən, səs) və onların ipucu */
.msg-actions .icon-act { padding: 4px 6px; position: relative; }
.msg-actions .icon-act svg { width: 15px; height: 15px; display: block; }
.msg-actions [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;                      /* sola hizalı - ilk düymədə panelin kənarından kəsilməsin */
  bottom: calc(100% + 6px);
  transform: translateY(2px);
  white-space: nowrap;
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--invert-text);
  background: var(--invert-bg);
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 20;
}
.msg-actions [data-tip]:hover::after,
.msg-actions [data-tip]:focus-visible::after { opacity: 1; transform: translateY(0); }
/* toxunma ekranında ipucu ilişib qalmasın */
@media (hover: none) { .msg-actions [data-tip]::after { display: none; } }

/* ---------- mikrofon yazısı (ASR girişi və TTS referansı) ---------- */

.rec-box {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.rec-box.on { border-style: solid; border-color: var(--text); background: var(--panel); }
.rec-info { flex: 1; min-width: 0; }
.rec-title { font-size: 14px; color: var(--text); }
.rec-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text); min-width: 42px; text-align: right; }

.rec-btn {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex: none;
}
.rec-btn:hover { border-color: var(--text); }
.rec-btn svg { width: 20px; height: 20px; display: block; }
.rec-btn .stop-icon { display: none; }
.rec-btn.unavail { opacity: 0.45; }
.on > .rec-btn, .rec-btn.on { background: var(--invert-bg); color: var(--invert-text); border-color: var(--invert-bg); }
.on > .rec-btn .mic-icon, .rec-btn.on .mic-icon { display: none; }
.on > .rec-btn .stop-icon, .rec-btn.on .stop-icon { display: block; }
.rec-btn:disabled { opacity: 0.5; cursor: default; }

.rec-eq { display: inline-flex; align-items: center; gap: 3px; height: 24px; }
.rec-eq i {
  --h: 0;
  width: 3px;
  height: calc(3px + var(--h) * 21px);
  border-radius: 2px;
  background: var(--text);
  transition: height 60ms linear;
}

/* TTS: oxunacaq cümlə */
.rec-panel {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rec-sentence {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--raised);
}
.rec-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-row .spacer { flex: 1; }
.rec-row audio { height: 36px; max-width: 100%; flex: 1 1 220px; }
.mic-link {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mic-link svg { width: 15px; height: 15px; }

@media (max-width: 560px) {
  .rec-box { flex-wrap: wrap; }
  .rec-sentence { font-size: 16px; }
}

/* ---------- sol panel siyahıları (çat, ASR, TTS): vaxt qrupları + üç nöqtəli menyu (ui.js) ---------- */

.list-group {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px 6px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-align: left;
  cursor: pointer;
}
.list-group:hover { color: var(--text); }
.list-group svg { width: 12px; height: 12px; flex: none; transition: transform 0.15s; }
.list-group.open svg { transform: rotate(90deg); }         /* ox aşağı dönür */
.list-group.pinned { cursor: default; }
.list-group.pinned svg { transform: none; }
.list-group .list-count { margin-left: auto; color: var(--faint); font-size: 10px; }

.list-item { padding-right: 34px; }

.row-more {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
}
.row-more svg { width: 14px; height: 14px; }
.list-item:hover .row-more, .row-more.on, .row-more:focus-visible { opacity: 1; }
.row-more:hover, .row-more.on { color: var(--text); border-color: var(--border-strong); background: var(--bg); }
@media (hover: none) { .row-more { opacity: 1; } }

.row-menu {
  position: fixed;
  z-index: 60;
  min-width: 150px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.row-menu-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.row-menu-item:hover { background: var(--raised); }
.row-menu-item.danger { color: var(--danger, #e5484d); }

/* ---------- çat: fayl və şəkil (yalnız AI) ---------- */

.attach-tray {
  max-width: 760px;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attach-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  height: 46px;
  padding: 4px 28px 4px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.attach-chip.busy { opacity: 0.7; }
.attach-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius); flex: none; }
.attach-chip .file-icon { width: 36px; height: 36px; }

.attach-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 20px;
  cursor: pointer;
}

.attach-x:hover { background: var(--raised); color: var(--text); }

.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--raised);
  border-radius: var(--radius);
  color: var(--muted);
}

.file-icon svg { width: 18px; height: 18px; }
.file-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.file-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 10px; color: var(--faint); white-space: nowrap; }

/* Mesajdakı fayllar (istifadəçi mesajının üstündə, sağda) */
.msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 85%; }

.file-thumb {
  display: block;
  width: 148px;
  height: 148px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--raised);
}

.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 6px 12px 6px 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.file-card:hover { border-color: var(--border-strong); }
.file-card .file-icon { width: 34px; height: 34px; }

/* Faylı çat sahəsinə sürükləyəndə yazı sahəsi işıqlanır */
.composer.drop { outline: 2px dashed var(--border-strong); outline-offset: -6px; }

@media (max-width: 600px) {
  .file-thumb { width: 112px; height: 112px; }
  .attach-chip { max-width: 100%; }
  .msg-files { max-width: 92%; }
}

/* ---------- daxili izah səhifəsi (/docs/banx) ---------- */
/* Sxemlər HTML qutularıdır (SVG yox): ekran daralanda öz-özünə alt-alta düzülür, rənglər
   mövzu dəyişənlərindən gəlir. Yaxşı/pis üçün yalnız iki rəng (--doc-good / --doc-bad). */

:root { --doc-good: #1f8a4c; --doc-bad: #c4473a; --doc-hl: rgba(255, 196, 0, 0.28); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --doc-good: #4cc382; --doc-bad: #ef6b5e; --doc-hl: rgba(255, 196, 0, 0.22); }
}
:root[data-theme="dark"] { --doc-good: #4cc382; --doc-bad: #ef6b5e; --doc-hl: rgba(255, 196, 0, 0.22); }

.doc-scroll { overflow-y: auto; }
.doc-loading, .doc-denied { max-width: 760px; margin: 60px auto; padding: 0 16px; color: var(--muted); font-size: 13px; text-align: center; }
.doc-denied { color: var(--text); border: 1px solid var(--border); padding: 24px 16px; }

.doc { max-width: 920px; margin: 0 auto; padding: 32px 16px 64px; font-size: 14px; line-height: 1.7; }
.doc b { font-weight: 600; }
.doc p { margin: 0 0 12px; }

.doc-head { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 20px; }
.doc-kicker { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.doc h1 { font-size: 30px; line-height: 1.2; margin: 6px 0 10px; font-weight: 600; }
.doc-lead { font-size: 16px; color: var(--muted); max-width: 680px; }
.doc-meta { font-size: 11px; color: var(--faint); margin: 0; }

.doc-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 36px; }
.doc-toc a {
  font-size: 12px; color: var(--muted); text-decoration: none; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.doc-toc a:hover { color: var(--text); border-color: var(--border-strong); }

.doc-sec { margin: 0 0 48px; scroll-margin-top: 16px; }
.doc h2 { display: flex; align-items: center; gap: 12px; font-size: 20px; line-height: 1.3; margin: 0 0 14px; font-weight: 600; }
.doc-num {
  flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--invert-bg); color: var(--invert-text); font-size: 14px; border-radius: var(--radius);
}
.doc-note { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--border-strong); padding-left: 12px; margin-top: 16px; }

/* qutular */
.doc-box { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); padding: 14px 16px; }
.doc-box p { margin: 0; font-size: 13px; color: var(--muted); }
.doc-box-t { font-weight: 600; margin-bottom: 6px; }
.doc-trio { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 10px; margin: 18px 0 4px; }
.doc-arrow { display: flex; align-items: center; color: var(--faint); font-size: 20px; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.doc-q {
  border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 16px;
  font-size: 14px; background: var(--bg);
}
.doc-q::before { content: "sual: "; color: var(--faint); }

/* addımlar: sol - nə edilir, sağ - misalda nə olur; aralarda ox */
.doc-steps { list-style: none; counter-reset: st; margin: 0; padding: 0; }
.doc-steps li {
  counter-increment: st; position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 14px 58px; margin-bottom: 26px;
  background: var(--panel);
}
.doc-steps li::before {
  content: counter(st); position: absolute; left: 14px; top: 14px; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong);
  border-radius: 50%; font-size: 13px; font-weight: 600; background: var(--bg);
}
.doc-steps li:not(:last-child)::after {
  content: "↓"; position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%);
  color: var(--faint); font-size: 16px; line-height: 20px;
}
.doc-step-what b { display: block; margin-bottom: 2px; }
.doc-step-what span { font-size: 13px; color: var(--muted); }
.doc-step-ex {
  font-size: 12.5px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; align-self: start; word-break: break-word;
}
.doc-step-ex::before { content: "misalda"; display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.doc-src { color: var(--faint); font-size: 11.5px; }

/* əvvəl / indi */
.doc-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 8px; }
.doc-col { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; }
.doc-col > p { font-size: 13px; color: var(--muted); }
.doc-col-h { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 12px; }
.doc-col-h.bad { color: var(--doc-bad); }
.doc-col-h.good { color: var(--doc-good); }
.doc-facts { margin: 12px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }

/* kartlar */
.doc-cardrow { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-card {
  display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg); padding: 8px; font-size: 12px; box-shadow: 2px 2px 0 var(--border);
}
.doc-card i { font-style: normal; padding: 1px 5px; border-radius: var(--radius); background: var(--raised); }
.doc-card i.hl, .doc-leaf.hl { background: var(--doc-hl); outline: 1px solid rgba(255, 196, 0, 0.6); }
.doc-cardrow.big .doc-card { flex: 1 1 140px; }
.doc-cardrow.small .doc-card { flex: 0 1 auto; min-width: 74px; }
.doc-card.dots { justify-content: center; align-items: center; color: var(--faint); box-shadow: none; border-style: dashed; }
.doc-card.wide { width: 100%; }
.doc-card.wide i { padding: 3px 6px; line-height: 1.5; }
.doc-parent {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius);
  background: var(--invert-bg); color: var(--invert-text);
}
.doc-parent.block { display: block; font-weight: 500; line-height: 1.5; padding: 3px 6px; }

.doc-meter { height: 8px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; overflow: hidden; }
.doc-meter span { display: block; height: 100%; background: var(--text); opacity: 0.55; }
.doc-meter-l { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }

.doc-answer { font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: var(--radius); border: 1px solid; }
.doc-answer.bad { color: var(--doc-bad); border-color: var(--doc-bad); }
.doc-answer.good { color: var(--doc-good); border-color: var(--doc-good); }

/* qanun ağacı: üst bənd -> alt bənd */
.doc-tree { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 8px; }
.doc-branch { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--panel); }
.doc-branch-h { font-size: 12.5px; padding-bottom: 8px; border-bottom: 1px dashed var(--border-strong); }
.doc-leaf { font-size: 12.5px; margin: 8px 0 0 18px; position: relative; padding: 4px 8px; border-radius: var(--radius); background: var(--bg); }
.doc-leaf::before { content: "└"; position: absolute; left: -16px; top: 3px; color: var(--faint); }

/* nəticə zolaqları */
.doc-bars { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.doc-bar { display: grid; grid-template-columns: 260px 1fr 64px; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 12.5px; }
.doc-bar-l { color: var(--muted); }
.doc-bar-t { height: 18px; background: var(--raised); border-radius: var(--radius); overflow: hidden; }
.doc-bar-t span { display: block; height: 100%; background: var(--border-strong); }
.doc-bar.now .doc-bar-t span { background: var(--doc-good); }
.doc-bar.now .doc-bar-l, .doc-bar.now b { color: var(--text); }
.doc-bar b { text-align: right; }
.doc-bars-axis { font-size: 11px; color: var(--faint); margin: 4px 0 0; }

.doc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.doc-kpi { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.doc-kpi b { display: block; font-size: 24px; line-height: 1.2; margin-bottom: 4px; }
.doc-kpi span { font-size: 12px; color: var(--muted); }

.doc-table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th, .doc-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.doc-table th { font-size: 11px; color: var(--muted); font-weight: 600; }
.doc-table tr.now td { background: var(--panel); }

.doc-list { padding-left: 18px; }
.doc-list li { margin-bottom: 8px; }
.doc-foot { border-top: 1px solid var(--border); padding-top: 16px; font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  .doc { padding-top: 20px; }
  .doc h1 { font-size: 24px; }
  .doc-trio { grid-template-columns: 1fr; }
  .doc-arrow { justify-content: center; transform: rotate(90deg); }
  .doc-grid, .doc-compare, .doc-tree, .doc-kpis { grid-template-columns: 1fr; }
  .doc-steps li { grid-template-columns: 1fr; padding-left: 52px; }
  .doc-bar { grid-template-columns: 1fr 52px; }
  .doc-bar-l { grid-column: 1 / -1; }
}

/* izah səhifəsi: 3-4-cü bölmələrin əlavə elementləri */
.doc-h3 { font-size: 15px; font-weight: 600; margin: 26px 0 8px; }
.doc-analogy { border: 1px solid var(--border); border-left: 3px solid var(--text); background: var(--panel);
  border-radius: var(--radius); padding: 12px 14px; margin: 10px 0 16px; font-size: 13.5px; }
.doc-takeaway { border: 1px solid var(--doc-good); border-radius: var(--radius); padding: 12px 14px; margin-top: 16px; font-size: 13.5px; }
.doc-eg { margin-top: 8px !important; font-style: italic; }
.doc-eg::before { content: "Misal: "; font-style: normal; color: var(--faint); }
.doc-chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: 8px; align-items: stretch; margin: 6px 0 8px; }
.doc-chain-step { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px; background: var(--bg); text-align: center; }
.doc-chain-step b { display: block; font-size: 13px; }
.doc-chain-step span { font-size: 11.5px; color: var(--muted); }
.doc-chain-arr, .doc-addr-arr { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 18px; }
.doc-addr { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 8px; margin: 8px 0; }
.doc-addr > div:not(.doc-addr-arr) { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: var(--panel); }
.doc-addr b { display: block; font-size: 18px; }
.doc-addr span { font-size: 12.5px; }
.doc-addr small { color: var(--muted); font-size: 11.5px; }
.doc-why { padding-left: 20px; font-size: 13px; margin: 10px 0 12px; }
.doc-why li { margin-bottom: 4px; }
.doc-meter.inline { display: inline-block; width: 70px; height: 8px; margin: 0 4px; vertical-align: middle; }

@media (max-width: 760px) {
  .doc-chain, .doc-addr { grid-template-columns: 1fr; }
  .doc-chain-arr, .doc-addr-arr { transform: rotate(90deg); }
}
