/* ==========================================================================
   Shahzoda AI — design system
   Uslub: developer tool (GitHub / Linear / Vercel) — ixcham, aniq, shovqinsiz.
   Ranglar komponentga emas, SEMANTIK tokenlarga yoziladi (pastdagi :root).
   ========================================================================== */

:root {
  /* --- yuzalar ---------------------------------------------------------- */
  --bg:             #0E0F13;   /* sahifa foni */
  --surface-nav:    #15161C;   /* sidebar va header */
  --surface:        #1B1C23;   /* card / panel */
  --surface-raised: #23242D;   /* hover, ko'tarilgan element */
  --surface-sunken: #131419;   /* input, kod bloki */

  /* --- chegaralar ------------------------------------------------------- */
  --border:         #30313C;   /* ko'rinadigan chegara */
  --border-subtle:  #23242D;   /* ichki ajratgich */

  /* --- matn ------------------------------------------------------------- */
  --text-strong:    #F4F4F5;   /* 16.8:1 — sarlavha */
  --text:           #CACBD2;   /* 11.4:1 — asosiy matn */
  --text-muted:     #9698A4;   /*  6.1:1 — ikkinchi darajali (WCAG AA) */
  --text-faint:     #7C7E8A;   /*  4.6:1 — meta, faqat katta/qalin bo'lmagan mayda matn */

  /* --- semantik ranglar ------------------------------------------------- */
  --primary:        #3B82F6;
  --primary-hover:  #2563EB;
  --primary-soft:   rgba(59, 130, 246, .14);
  --primary-line:   rgba(59, 130, 246, .38);

  --success:        #10B981;
  --success-fg:     #04241B;   /* yashil fon ustidagi to'q matn */
  --success-hover:  #22D39A;
  --success-active: #0B9A6B;
  --success-ring:   #34D399;
  --success-soft:   rgba(16, 185, 129, .14);
  --success-line:   rgba(16, 185, 129, .40);

  /* ikkilamchi amal — tiniq royal/azure blue */
  --info:            #2563EB;
  --info-hover:      #3B82F6;
  --info-active:     #1D4ED8;
  --info-fg:         #EAF2FF;
  --info-ring:       #60A5FA;

  --warning:        #F59E0B;
  --warning-hover:  #FBBF24;
  --warning-active: #D98706;
  --warning-fg:     #3A2506;   /* amber fon ustidagi to'q matn */
  --warning-ring:   #FCD34D;
  --warning-soft:   rgba(245, 158, 11, .14);
  --warning-line:   rgba(245, 158, 11, .38);

  --danger:         #EF4444;
  --danger-soft:    rgba(239, 68, 68, .14);
  --danger-line:    rgba(239, 68, 68, .38);

  /* --- shakl va harakat ------------------------------------------------- */
  --r-sm: 6px;
  --r:    8px;
  --r-lg: 10px;
  --t-fast: 150ms ease;
  --t:      180ms ease;
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);

  /* --- shriftlar -------------------------------------------------------- */
  --font: "IBM Plex Sans", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* --- o'lchamlar ------------------------------------------------------- */
  --side-w: 244px;
  --side-w-collapsed: 62px;
  --topbar-h: 56px;

  /* eski nomlar (shablon ichidagi inline uslublar uchun) */
  --ink: var(--text-strong);
  --muted: var(--text-muted);
  --faint: var(--text-faint);
  --line: var(--border);
  --panel: var(--surface);
  --green: var(--success);
  --amber: var(--warning);
  --red: var(--danger);
  --ok: var(--success);
}

/* ============================================================ asoslar ==== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, textarea, select { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2B2C36; border-radius: 6px; border: 2px solid transparent;
                            background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3A3B47; background-clip: content-box; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.mono { font-family: var(--mono); font-size: .92em; letter-spacing: .01em; }
.grow { flex: 1; min-width: 0; }
.clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================ karkas ===== */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.app.collapsed { grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr); }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.content {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  padding: 12px;
}

/* ============================================================ sidebar ==== */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-nav);
  border-right: 1px solid var(--border-subtle);
}

.side-head {
  display: flex;
  align-items: center;
  gap: 9px;
  height: var(--topbar-h);
  padding: 0 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.logo {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--primary-soft);
  color: var(--primary);
}
.side-title {
  font-size: 14px; font-weight: 600; color: var(--text-strong);
  white-space: nowrap; overflow: hidden;
}
.side-collapse {
  margin-left: auto; width: 24px; height: 24px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-faint); cursor: pointer; line-height: 1;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-collapse:hover { background: var(--surface-raised); color: var(--text); }

.side-label {
  padding: 16px 16px 7px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.side-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font-size: 13px; text-align: left; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-item svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--text-muted); }
.side-item > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
                    text-overflow: ellipsis; }
.side-item:hover { background: var(--surface-raised); color: var(--text-strong); }
.side-item:hover svg { color: var(--text); }
.side-item.on {
  background: var(--primary-soft);
  color: var(--text-strong);
  font-weight: 500;
}
.side-item.on svg { color: var(--primary); }
.side-item.on::before {
  content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}

.side-count {
  flex: 0 0 auto; min-width: 20px; height: 18px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--surface-raised); border: 1px solid var(--border-subtle);
  color: var(--text); font-family: var(--mono); font-size: 11px; font-style: normal;
  line-height: 1;
}
.side-count.zero { color: var(--text-faint); background: transparent; }
.side-count.warn { background: var(--warning-soft); border-color: var(--warning-line);
                   color: var(--warning); }

/* --- sidebar pastki qismi ------------------------------------------------ */
.side-foot { margin-top: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.foot-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r);
  padding: 11px 12px;
}
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.foot-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted);
}
.foot-label svg { color: var(--text-muted); }
.foot-val { font-size: 13px; font-weight: 600; color: var(--text-strong); }

.cap-bar {
  height: 4px; margin: 9px 0 7px; border-radius: 3px;
  background: var(--surface-raised); overflow: hidden;
}
.cap-bar i { display: block; height: 100%; width: 0; border-radius: 3px;
             background: var(--success); transition: width var(--t), background var(--t); }
.cap-bar.bad i { background: var(--danger); }
.cap-bar.ok  i { background: var(--success); }
.cap-bar:not(.ok):not(.bad) i { background: var(--warning); }

.foot-sub {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--text-muted);
}
.foot-sub b { color: var(--text); font-weight: 600; font-family: var(--mono); }
.foot-sub.one { justify-content: flex-start; margin-top: 5px; }

.foot-div { height: 1px; margin: 11px -12px; background: var(--border-subtle); }

.foot-state { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px;
              color: var(--text); }
.sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint);
        flex: 0 0 auto; }
.sdot.busy { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.sdot.paused { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }

.side-user {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r);
}
.uava {
  width: 26px; height: 26px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 600;
}
.uname { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text);
         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ustate { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
          color: var(--text-muted); white-space: nowrap; }
.side-cfg {
  width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: var(--r-sm); color: var(--text-faint); text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-cfg:hover { background: var(--surface-raised); color: var(--text-strong); }
.udot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.udot.off { background: var(--danger); }

/* yig'ilgan sidebar */
.app.collapsed .side-title,
.app.collapsed .side-label,
.app.collapsed .side-item > span,
.app.collapsed .side-count,
.app.collapsed .foot-card,
.app.collapsed .uname,
.app.collapsed .ustate { display: none; }
.app.collapsed .side-item { justify-content: center; padding: 9px 0; }
.app.collapsed .side-user { justify-content: center; padding: 8px 0; }
.app.collapsed .side-head { justify-content: center; padding: 0 8px; }
.app.collapsed .side-collapse { transform: rotate(180deg); }

/* ============================================================= header ==== */
.topbar {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); flex: 0 0 auto;
  padding: 0 14px;
  background: var(--surface-nav);
  border-bottom: 1px solid var(--border-subtle);
}
.top-title { display: flex; flex-direction: column; justify-content: center;
             margin-right: auto; min-width: 0; }
.top-title h1 { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--text-strong);
                line-height: 1.25; white-space: nowrap; }
.top-title p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.3;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-toggle {
  display: none;
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.side-toggle:hover { background: var(--surface-raised); }

/* ============================ header — o'ng boshqaruv paneli ============= */
.hdr-controls { display: flex; align-items: center; gap: 12px; margin-left: auto;
                flex-wrap: nowrap; min-width: 0; }

/* --- 1) preview serverlar: holat bloki (tugma emas) ---------------------- */
.cap-status {
  display: flex; align-items: center; gap: 9px; flex: 0 0 auto;
  height: 34px; padding: 0 2px; cursor: default; user-select: none;
}
.cap-ico { color: var(--text-muted); flex: 0 0 auto; }
/* kenglik matnga qarab o'zi o'lchanadi — matn hech qachon kesilmaydi */
.cap-body { display: flex; flex-direction: column; gap: 5px; flex: 0 0 auto;
            min-width: 140px; }
.cap-line { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.cap-name { font-size: 12px; color: var(--text-muted); }
.cap-num { font-family: var(--mono); font-size: 12.5px; color: var(--text-strong); }
.cap-unit { font-size: 11.5px; color: var(--text-muted); }
.cap-free { font-size: 11.5px; color: var(--success); }
.cap-track {
  height: 2px; border-radius: 2px; background: #2B2C36; overflow: hidden;
}
.cap-track i {
  display: block; height: 100%; width: 0; border-radius: 2px; background: var(--primary);
  transition: width var(--t), background var(--t);
}
.cap-status.warn .cap-track i { background: var(--warning); }
.cap-status.warn .cap-free { color: var(--warning); }
.cap-status.full .cap-track i { background: var(--danger); }
.cap-status.full .cap-free { color: var(--danger); }
.cap-status.full .cap-num { color: var(--danger); }
.cap-status.flash .cap-num { animation: num-flash 1s ease-out 1; }
@keyframes num-flash { 0% { color: var(--primary); } 100% { color: inherit; } }

/* --- 2) asosiy CTA ------------------------------------------------------- */
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 15px; border: 0; border-radius: var(--r-sm);
  background: linear-gradient(180deg, #12C88D 0%, #0FA672 100%);
  color: #04251A; font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 4px 14px rgba(16, 185, 129, .22);
  transition: filter var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.cta:hover { filter: brightness(1.08);
             box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset, 0 5px 18px rgba(16, 185, 129, .32); }
.cta:active { filter: brightness(.96); }
.cta.running {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}
.cta.running:hover { background: var(--surface-raised); filter: none; }

/* --- 3) qaror rejimi: uchalasi bitta segmentda --------------------------- */
.seg {
  position: relative;
  display: inline-flex; align-items: center;
  height: 34px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.seg-div { width: 1px; height: 16px; background: var(--border-subtle); flex: 0 0 auto; }
.mode-opt {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-muted);
  font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.mode-opt svg { color: currentColor; opacity: .75; }
.mode-opt:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.mode-opt.on {
  background: var(--primary-soft); color: var(--text-strong); font-weight: 500;
}
.mode-opt.on svg { color: var(--primary); opacity: 1; }
.mode-opt b {
  font-family: var(--mono); font-size: 11.5px; color: inherit;
  padding-left: 5px; margin-left: 1px; border-left: 1px solid rgba(255, 255, 255, .14);
}
/* faol rejim ranglari */
.seg[data-mode="auto"] .mode-opt.on { background: var(--success-soft); }
.seg[data-mode="auto"] .mode-opt.on svg { color: var(--success); }
.seg[data-mode="effort"] .mode-opt.on { background: var(--warning-soft); }
.seg[data-mode="effort"] .mode-opt.on svg { color: var(--warning); }
.seg[data-mode="effort"] .mode-opt.on b { color: var(--warning); }

/* effort qiymati popoveri — segment ichidan chiqadi */
.eff-pop {
  position: absolute; right: 0; top: calc(100% + 7px); z-index: 30;
  min-width: 218px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.eff-hint { margin: 4px 8px 7px; font-size: 11px; line-height: 1.4; color: var(--text-muted); }
.eff-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text); font-family: var(--mono); font-size: 12px;
  text-align: left; cursor: pointer; transition: background var(--t-fast), color var(--t-fast);
}
.eff-opt i { font-family: var(--font); font-style: normal; font-size: 11.5px;
             color: var(--text-muted); margin-left: auto; }
.eff-opt:hover { background: var(--surface-raised); }
.eff-opt.on { background: var(--warning-soft); color: var(--warning); }
.eff-opt.on i { color: var(--warning); }

/* --- 4) chiqish ---------------------------------------------------------- */
.ghost-icon {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.ghost-icon:hover { background: rgba(255, 255, 255, .05); color: var(--text-strong);
                    border-color: var(--border-subtle); }
.logout { display: flex; }

/* ============================================================== panel ==== */
.pane {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.list-pane { flex: 0 1 380px; min-width: 340px; max-width: 400px; }
.detail-pane { flex: 1 1 0; min-width: 0; position: relative; }

.pane-head {
  display: flex; align-items: center; gap: 9px;
  height: 46px; flex: 0 0 auto; padding: 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-nav);
}
.pane-head b { font-size: 13px; font-weight: 600; color: var(--text-strong);
               white-space: nowrap; }
.pane-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.pane-count b { font-family: var(--mono); color: var(--text); font-weight: 600; }

/* Ro'yxat sarlavhasi: 1-qator — nom + son, 2-qator — filtr tablari.
   Bitta qatorga tiqilsa, tor ustunda matnlar siqilib ketardi. */
.list-head {
  height: auto; min-height: 46px; padding: 9px 14px;
  flex-wrap: wrap; gap: 8px; row-gap: 9px; align-items: center;
}
.list-head .list-filter,
.list-head .list-search { flex: 0 0 100%; }

/* qidiruv maydoni */
.list-search {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px; border-radius: var(--r);
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  color: var(--text-faint);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.list-search:focus-within {
  border-color: var(--primary-line); background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.list-search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font-size: 12.5px; color: var(--text-strong); font-family: inherit;
}
.list-search input::placeholder { color: var(--text-faint); }
.list-search input::-webkit-search-cancel-button { display: none; }
.q-clear {
  flex: 0 0 auto; border: 0; background: none; cursor: pointer;
  color: var(--text-faint); font-size: 17px; line-height: 1; padding: 0 2px;
  transition: color var(--t-fast);
}
.q-clear:hover { color: var(--text-strong); }

/* pastda avtomatik yuklanish ko'rsatkichi */
.list-more {
  padding: 14px; text-align: center;
  font-size: 12px; color: var(--text-faint);
}
.list-more.loading::after {
  content: ""; display: inline-block; margin-left: 7px;
  width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: btn-spin 700ms linear infinite;
}
.count-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  font-family: var(--mono); font-size: 11px; color: var(--text);
}
.list-filter { display: flex; gap: 5px; flex-wrap: nowrap; }
.list-filter .lf {
  flex: 1 1 auto; min-width: 0;
  border: 1px solid transparent; background: var(--surface-sunken); cursor: pointer;
  padding: 5px 6px; border-radius: 7px;
  font-size: 11px; line-height: 1.25; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.list-filter .lf:hover { color: var(--text); background: var(--surface-raised); }
.list-filter .lf.on { color: var(--text-strong); background: var(--surface-raised);
                      border-color: var(--border); }
.list-filter .lf.ok.on { color: var(--success); border-color: var(--success-line);
                         background: var(--success-soft); }
.list-filter .lf.cr.on { color: var(--warning); border-color: var(--warning-line);
                         background: var(--warning-soft); }

/* ro'yxat konteyneri: sarlavha qotadi, pastda nozik fade */
.list-body { position: relative; padding: 0; }
.list-body::-webkit-scrollbar { width: 6px; }
.list-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .08); border-radius: 6px;
}
.list-body:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); }
.list-pane { position: relative; }
.list-pane::after {
  content: ""; position: absolute; left: 0; right: 6px; bottom: 0; height: 28px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--surface));
}
.pane-sub { font-size: 12px; color: var(--text-muted); min-width: 0;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pane-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.pane-empty {
  padding: 34px 20px; text-align: center; color: var(--text-muted); font-size: 12.5px;
}

/* ====================================================== MR ro'yxati ====== */
/* Har element uch qatorli aniq iyerarxiya:
   1) #MR + Jira ... holat badge'i · 2) sarlavha · 3) muallif · branch · vaqt */
.mr-row {
  position: relative;
  padding: 12px; margin: 0;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.mr-row + .mr-row { border-top: 1px solid var(--border-subtle); }
.mr-row:hover { background: var(--surface-raised); }
.mr-row.sel {
  background: var(--primary-soft);
  border-left-color: var(--primary);
}
.mr-row.sel + .mr-row { border-top-color: transparent; }

.mr-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0;
}
.mr-ids { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.mr-status { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.mr-id { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text-strong); }
.mr-jira {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mr-title {
  font-size: 13px; color: var(--text-strong); line-height: 1.45;
  font-weight: 500; margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.mr-row.sel .mr-jira { color: var(--text); }

.mr-meta {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}
.mr-meta > span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Meta: muallif · branch · vaqt — vaqt hech qachon kesilmaydi,
   branch birinchi bo'lib qisqaradi, keyin muallif. */
.mr-author { flex: 1 1 auto; min-width: 5ch; }
.mr-branch {
  flex: 2 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
}
.mr-when, .mr-meta .live-clock {
  flex: 0 0 auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-muted);
}
.mr-meta .dot { flex: 0 0 auto; color: #3A3B47; }
.mr-actions { display: flex; gap: 4px; margin-left: auto; flex: 0 0 auto; }

/* «E3» — Review effort, holat badge'ining yonida, barcha elementlarda bir joyda */
.effort {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px; border-radius: 5px;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--text-muted);
  cursor: help; transition: color 150ms ease, border-color 150ms ease;
}
.effort.hard { color: var(--warning); border-color: var(--warning-line);
               background: var(--warning-soft); }

/* holat / verdikt belgisi */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--surface-raised);
  color: var(--text-muted);
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
.badge.ok      { background: var(--success-soft); border-color: var(--success-line); color: var(--success); }
.badge.warn    { background: var(--warning-soft); border-color: var(--warning-line); color: var(--warning); }
.badge.bad     { background: var(--danger-soft);  border-color: var(--danger-line);  color: var(--danger); }
.badge.live    { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.badge.muted   { color: var(--text-faint); }
.badge.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

/* ======================================================== tafsilotlar ==== */
.detail-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-muted); font-size: 12.5px;
}
.detail-empty svg { color: #2F303B; }

.detail { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 18px; }

.detail-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.d-mr { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.d-mr b { color: var(--text-strong); }
/* sarlavha qatoridagi havola tugmalari (GitLab / Jira) */
.head-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle); background: var(--surface-sunken);
  color: var(--text-muted); text-decoration: none;
  font-size: 11.5px; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.head-link svg { opacity: .85; }
.head-link:hover { background: var(--surface-raised); color: var(--text-strong);
                   border-color: var(--border); }
/* brend ranglari: GitLab — to'q sariq, Jira — ko'k */
.head-link.gl {
  color: #FC6D26; border-color: rgba(252, 109, 38, .30); background: rgba(252, 109, 38, .10);
}
.head-link.gl:hover { background: rgba(252, 109, 38, .18); border-color: rgba(252, 109, 38, .55);
                      color: #FF8A4C; }
.head-link.jira {
  font-family: var(--mono); font-size: 11px;
  color: #4C9AFF; border-color: rgba(38, 132, 255, .30); background: rgba(38, 132, 255, .10);
}
.head-link.jira:hover { background: rgba(38, 132, 255, .18); border-color: rgba(38, 132, 255, .55);
                        color: #79B8FF; }
.d-jira { font-family: var(--mono); font-size: 11px; color: inherit; }

.d-title {
  margin: 0 0 14px; font-size: 16px; font-weight: 600; line-height: 1.4;
  color: var(--text-strong);
}

/* metadata — 2×2 grid: siqilmaydi, uzun qiymat ham o'qiladi */
.stat-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; margin-bottom: 24px;
}
@media (min-width: 1500px) {                 /* keng ekranda bitta qator */
  .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stat-card {
  padding: 12px 14px; border-radius: var(--r);
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  min-width: 0;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.stat-card:hover { border-color: var(--border); background: var(--surface); }
.stat-label {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}
.stat-val {
  font-size: 13px; line-height: 1.45; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* bloklar (card ichida card yo'q — faqat sarlavha + tana) */
.block { margin-bottom: 24px; }
.block:last-child { margin-bottom: 0; }
.block-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted);
}
.block-head svg { color: var(--text-muted); }
.bdot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.block-body {
  padding: 16px; border-radius: var(--r);
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
}
/* QA hisoboti — o'qish uchun keng qator oralig'i va cheklangan kenglik */
.d-summary {
  margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--text);
  max-width: 78ch;
}
.d-summary.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
                   overflow: hidden; }
.more {
  margin-top: 7px; background: none; border: 0; padding: 0;
  color: var(--primary); font-size: 12px; cursor: pointer;
}
.more:hover { color: var(--primary-hover); text-decoration: underline; }

.findings { list-style: none; margin: 11px 0 0; padding: 0; display: flex;
            flex-direction: column; gap: 7px; }
.findings li {
  position: relative; padding-left: 16px;
  font-size: 12.5px; line-height: 1.55; color: var(--text-muted);
}
.findings li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 7px; height: 7px; border-radius: 2px; background: var(--warning);
}
.findings li.major::before { background: var(--danger); }
.findings li b { color: var(--text-strong); font-weight: 600; }

.full-report { margin-top: 11px; }
.full-report summary {
  cursor: pointer; font-size: 12px; color: var(--text-muted); list-style: none;
}
.full-report summary::-webkit-details-marker { display: none; }
.full-report summary::before { content: "▸ "; color: var(--text-faint); }
.full-report[open] summary::before { content: "▾ "; }
.full-report summary:hover { color: var(--text); }
.report-md {
  margin: 10px 0 0; padding: 14px 16px; max-height: 520px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border-subtle); border-radius: var(--r);
  font-size: 12.5px; line-height: 1.65; color: var(--text);
}
.report-md .md-h { margin: 16px 0 8px; font-size: 13px; color: var(--text-strong); }
.report-md > .md-h:first-child { margin-top: 0; }
.report-md .md-table { font-size: 11.5px; table-layout: fixed; max-width: 100%; }
.report-md .md-table td, .report-md .md-table th { overflow-wrap: anywhere; }
.report-md .md-table th { background: var(--surface); }
.report-md .md-pre { background: var(--surface-sunken); }
.report-md p { margin: 0 0 9px; }
.report-md .md-list { padding-left: 20px; }

.stand-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 11px;
              padding-top: 11px; border-top: 1px solid var(--border-subtle); }
.stand-line a { color: var(--primary); text-decoration: none; font-size: 12.5px; }
.stand-line a:hover { color: var(--primary-hover); text-decoration: underline; }
.stand-warn { color: var(--warning); font-size: 12.5px; line-height: 1.5; }
.copy {
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--text-muted);
  border-radius: var(--r-sm); padding: 3px 8px; font-family: var(--mono); font-size: 11px;
  cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast);
}
.copy:hover { color: var(--text-strong); border-color: #3B3C48; }

/* ==================================================== bosqichlar (timeline) */
.live-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; border-radius: 4px;
  background: var(--success-soft); border: 1px solid var(--success-line);
  color: var(--success); font-size: 10px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
}
.live-tag::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--success);
  animation: pulse 1.6s ease-in-out infinite;
}
.steps-count { font-family: var(--mono); font-size: 11px; color: var(--text-muted);
               text-transform: none; letter-spacing: 0; }

.steps {
  position: relative;
  padding: 14px 16px 14px 8px;
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
  border-radius: var(--r);
}
.steps-empty { padding: 20px 14px; color: var(--text-muted); font-size: 12.5px;
               text-align: center; }

.step {
  position: relative; padding: 0 8px 20px 30px;
}
.step:last-child { padding-bottom: 0; }
/* nuqta — bosqich holati rangi bilan */
.step::before {
  content: ""; position: absolute; left: 7px; top: 3px; z-index: 1;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface-sunken);
  transition: border-color var(--t-fast), background var(--t-fast);
}
/* nuqtalarni bog'lovchi uzluksiz chiziq */
.step::after {
  content: ""; position: absolute; left: 11.5px; top: 15px; bottom: -3px; width: 2px;
  border-radius: 2px; background: var(--border-subtle);
}
.step:last-child::after { display: none; }
/* tugagan bosqichdan keyingi chiziq ham yashil — oqim ko'rinib tursin */
.step.done::after, .step.end::after, .step.approved::after {
  background: linear-gradient(180deg, var(--success-line), var(--border-subtle));
}
.step.done::before    { border-color: var(--success); background: var(--success); }
.step.end::before     { border-color: var(--success); background: var(--success); }
.step.verdict::before { border-color: var(--warning); background: var(--warning-soft); }
.step.stop::before    { border-color: var(--danger);  background: var(--danger-soft); }
.step.finding::before { border-color: var(--warning); background: transparent; }
.step.approved::before { border-color: var(--success); background: var(--success); }
.step.approved .step-title { color: var(--success); font-weight: 600; }
.step.rejected::before { border-color: var(--danger); background: var(--danger-soft); }
.step.rejected .step-title { color: var(--danger); font-weight: 600; }
.step.waiting::before { border-color: var(--warning); background: var(--warning-soft); }
/* Natija eskirdi — yangi commit tushdi. Xato emas, shuning uchun qizil emas:
   diqqatni tortadigan, lekin bezovta qilmaydigan kulrang-sariq. */
.step.stale::before { border-color: var(--wait-line); background: var(--wait-tint); }
.step.stale .step-title { color: var(--wait-line); font-weight: 600; }
.step.current::before, .step.live::before {
  border-color: var(--primary); background: var(--primary);
  animation: step-pulse 1.8s ease-in-out infinite;
}
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .45); }
  50%      { box-shadow: 0 0 0 5px rgba(59, 130, 246, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .step.current::before, .step.live::before { animation: none; }
}
.step-title { font-size: 13px; font-weight: 500; color: var(--text-strong); line-height: 1.45; }
.step.current .step-title { color: var(--primary); font-weight: 600; }
.step.finding .step-title { color: var(--warning); }
.step-meta { margin-top: 4px; font-family: var(--mono); font-size: 11px;
             color: var(--text-faint); letter-spacing: .01em; }
.step-detail {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--border-subtle);
  font-size: 12px; line-height: 1.65; color: var(--text-muted);
  white-space: pre-wrap; word-break: break-word;
  max-width: 88ch;
}

/* jonli qator */
.step.live .step-title {
  color: var(--primary); font-weight: 600;
  display: flex; align-items: center; gap: 7px;
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 1 } 50% { opacity: .6 } }
.dots { display: inline-flex; gap: 3px; }
.dots i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--primary);
  animation: bounce 1.25s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45 }
                    40% { transform: translateY(-3px); opacity: 1 } }

/* ============================================================ amallar ==== */
.action-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface-nav); border-top: 1px solid var(--border);
}
.action-bar .btn { height: 38px; padding: 0 15px; border-radius: var(--r); gap: 8px; }
.action-bar .btn svg { flex: 0 0 auto; }
@media (max-width: 760px) {
  .action-bar { flex-wrap: nowrap; overflow-x: auto; }
  .action-bar::-webkit-scrollbar { height: 0; }
}
.act-note { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.act-note.hint { color: var(--warning); }

/* Qaror izi: «Tasdiqlandi — admin» / «Rad etildi — admin» */
.act-decided {
  display: inline-flex; align-items: center; gap: 7px; margin-left: auto;
  padding: 5px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text);
}
.act-decided.ok  { border-color: var(--success-line); background: var(--success-soft);
                   color: var(--success); }
.act-decided.no  { border-color: var(--danger-line);  background: var(--danger-soft);
                   color: var(--danger); }
.act-decided .act-who {
  padding-left: 8px; margin-left: 1px;
  border-left: 1px solid currentColor; opacity: .65;
  font-weight: 400; font-family: var(--mono); font-size: 11px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 13px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--primary); color: #fff;
  font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn.busy { opacity: .55; cursor: default; }
/* Asosiy ijobiy amal — yorqin emerald */
.btn.ok { background: var(--success); color: var(--success-fg); font-weight: 600; }
.btn.ok:hover  { background: var(--success-hover); }
.btn.ok:active { background: var(--success-active); }
.btn.ok:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--success-ring); }

/* Ikkilamchi jarayon — tiniq royal blue */
.btn.secondary { background: var(--info); color: var(--info-fg); font-weight: 500; }
.btn.secondary:hover  { background: var(--info-hover); }
.btn.secondary:active { background: var(--info-active); }
.btn.secondary:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--info-ring); }

/* Ehtiyotkor alternativ — amber/oltin sariq (qizil emas: bu destructive emas) */
.btn.amber { background: var(--warning); color: var(--warning-fg); font-weight: 600; }
.btn.amber:hover  { background: var(--warning-hover); }
.btn.amber:active { background: var(--warning-active); }
.btn.amber:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--warning-ring); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #DC2626; }
/* Neytral amal — e'tibor tortmaydi (xato ham, ogohlantirish ham emas) */
.btn.ghost {
  background: transparent; border-color: var(--border); color: var(--text-muted);
}
.btn.ghost:hover {
  background: var(--surface-raised); border-color: var(--border);
  color: var(--text-strong);
}
.btn.tiny { height: 26px; padding: 0 10px; font-size: 12px; }

/* Majburiy qayta tekshirish — kam uchraydigan, oqibatli amal.
   Qo'shni «Qayta navbatga» ghost bo'lgani uchun bu yagona to'ldirilgan tugma:
   amber fon, to'q matn, qalin shrift va yengil halo bilan ajralib turadi.
   Qizil emas — bu buzuvchi amal emas, lekin e'tibor talab qiladi. */
.btn.force {
  background: var(--warning); color: var(--warning-fg);
  border-color: color-mix(in srgb, var(--warning) 70%, #000);
  font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 28%, transparent),
              0 2px 10px -3px color-mix(in srgb, var(--warning) 55%, transparent);
}
.btn.force:hover {
  background: var(--warning-hover);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 45%, transparent),
              0 3px 14px -3px color-mix(in srgb, var(--warning) 70%, transparent);
}
.btn.force:active { background: var(--warning-active); }
.btn.force:focus-visible {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--warning-ring);
}
.btn.force svg { opacity: .95; }
/* `btn` o'zi ko'k — `primary` shunchaki niyatni aniq bildiradi */
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
/* Qaytarib bo'lmaydigan amal: solid qizil emas — qizil kontur, hover'da yumshoq fon.
   Solid qizil e'tiborni shu darajada tortadiki, oddiy amallar ko'rinmay qoladi. */
.btn.ghost.danger {
  background: transparent; border-color: var(--danger-line); color: var(--danger);
}
.btn.ghost.danger:hover {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger);
}
.btn:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary-line);
}
.btn.ghost:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--border); }
.btn.ghost.danger:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--danger-line); }

.icon-btn {
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-raised); color: var(--text-strong); }
.icon-btn.ok:hover { background: var(--success-soft); border-color: var(--success-line);
                     color: var(--success); }
.icon-btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-line);
                         color: var(--danger); }

/* ======================================================= QA Lead chati === */
.chat-content { display: flex; gap: 12px; }
.chat-pane { flex: 1; min-width: 0; }
.history-pane { flex: 0 0 320px; max-width: 360px; }

.chat-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 20px 22px;
  display: flex; flex-direction: column; gap: 8px;
  /* juda nozik tungi fon — o'qishga xalaqit bermaydi */
  background:
    radial-gradient(1200px 300px at 50% -80px, rgba(59, 130, 246, .06), transparent 70%),
    linear-gradient(180deg, #17181F 0%, var(--surface) 240px);
  border-top: 1px solid var(--border-subtle);
}
/* nozik scrollbar — hover'da to'liq ko'rinadi */
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .08); border-radius: 6px;
}
.chat-scroll:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); }

.chat-welcome {
  margin: auto; max-width: 440px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
}
.cw-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
}
.cw-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.cw-sub { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-muted); }

/* --- kun ajratgichi ------------------------------------------------------ */
.day-sep { display: flex; justify-content: center; margin: 8px 0 4px; }
.day-sep span {
  padding: 3px 11px; border-radius: 20px;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  font-size: 11px; color: var(--text-muted);
}

/* --- xabar qatori -------------------------------------------------------- */
.msg-row {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 4px;                       /* bitta guruh ichida */
}
.msg-row:not(.grouped) { margin-top: 22px; }   /* turli senderlar orasi */
.msg-row:first-child, .day-sep + .msg-row { margin-top: 0; }
.msg-row.me { flex-direction: row-reverse; }
.msg-main { display: flex; flex-direction: column; min-width: 0; max-width: 72%; }
.msg-row.me .msg-main { align-items: flex-end; }

.ava {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  visibility: hidden;                    /* faqat guruh boshida ko'rinadi */
  border: 1px solid var(--border-subtle);
}
.msg-row.has-ava .ava { visibility: visible; }
.ava.bot { background: var(--primary-soft); color: var(--primary); }
.ava.me { background: var(--surface-raised); color: var(--text); }

.msg-head {
  display: flex; align-items: baseline; gap: 5px; margin: 0 2px 5px;
  font-size: 11px; color: var(--text-muted);
}
.msg-row.grouped .msg-head { display: none; }
.msg-who { color: var(--text); font-weight: 500; }
.msg-dot { color: var(--text-faint); }
.msg-time { font-family: var(--mono); font-size: 10.5px; }

/* --- pufakchalar --------------------------------------------------------- */
.bubble {
  position: relative;
  padding: 10px 13px; border-radius: 12px;
  font-size: 13px; line-height: 1.6; min-width: 0;
  max-width: 100%; overflow: hidden;   /* ichidagi hech narsa fondan oshmasin */
}
.bubble .md > * { max-width: 100%; }
.bubble .md-pre { overflow-x: auto; }  /* kod bloki o'zi suriladi */
.bubble.agent {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  border-radius: 12px;
}
/* «dum» effekti: guruh boshida yuqori-chap, oxirida pastki-chap 4px */
.msg-row:not(.grouped) .bubble.agent { border-top-left-radius: 4px; }
.msg-row.tail .bubble.agent { border-bottom-left-radius: 4px; }
.bubble.agent.err {
  background: var(--danger-soft); border-color: var(--danger-line);
  border-left-color: var(--danger); color: #FCA5A5;
}
.bubble.me {
  background: var(--primary); color: #fff;
  border-radius: 12px;
}
.msg-row.me:not(.grouped) .bubble.me { border-top-right-radius: 4px; }
.msg-row.me.tail .bubble.me { border-bottom-right-radius: 4px; }

.bubble .meta { display: block; margin-top: 6px; font-family: var(--mono); font-size: 11px;
                color: var(--text-muted); }
.bubble.me .meta { color: rgba(255, 255, 255, .7); }

/* nusxalash/javob tugmalari uslubi pastda, `.msg-tools` blokida */

/* typing */
.typing-bubble { color: var(--text-muted); font-size: 12.5px; }
.typing { display: inline-flex; gap: 3px; margin-left: 3px; }
.typing i {
  width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted);
  animation: bounce 1.25s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

/* chatdagi markdown */
.md { font-size: 13px; line-height: 1.62; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md b { color: var(--text-strong); font-weight: 600; }
.md a { color: var(--primary); }
.md code {
  display: inline-block; vertical-align: baseline;
  background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 6px;
  padding: 2px 6px; font-family: var(--mono); font-size: 11.5px; color: #9ECBFF;
  white-space: nowrap;                 /* chip o'rtasidan uzilmasin */
  max-width: 100%; overflow-x: auto;
}
.md .md-pre code, .md pre code {
  display: inline; padding: 0; border: 0; background: none; white-space: pre;
}
.bubble.me .md code {
  background: rgba(0, 0, 0, .22); border-color: rgba(255, 255, 255, .18); color: #E6F0FF;
}
.md .md-pre, .md pre {
  background: var(--bg); border: 1px solid var(--border-subtle); border-radius: var(--r-sm);
  padding: 10px 12px; overflow-x: auto; margin: 9px 0;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
}
.md .md-h { margin: 12px 0 7px; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.md .md-list { margin: 0 0 8px; padding-left: 18px; }
.md .md-list li { margin: 3px 0; }
.md .warn-line {
  margin: 8px 0; padding: 7px 11px;
  border-left: 3px solid var(--warning, #F59E0B);
  background: rgba(245, 158, 11, .07);
  border-radius: 0 6px 6px 0; color: var(--text-strong);
  list-style: none;
}
.md .md-list .warn-line { margin-left: -18px; }
.bubble.me .md .warn-line {
  border-left-color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .14); color: #fff;
}
.md .md-list li { padding-left: 2px; }
.md .md-quote {
  margin: 8px 0; padding: 6px 11px; border-left: 2px solid var(--border);
  color: var(--text-muted);
}
.md .md-hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 11px 0; }
/* Jadval hech qachon pufakchadan tashqariga chiqmaydi.
   `table-layout: fixed` bo'lmasa brauzer ustun kengligini ichidagi eng uzun
   so'zga qarab tanlaydi va `width: 100%` ni e'tiborsiz qoldiradi — statistika
   jadvali aynan shu sababli xabar fonidan oshib ketardi. */
.md .md-table {
  width: 100%; max-width: 100%; table-layout: fixed;
  border-collapse: collapse; margin: 9px 0; font-size: 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--r-sm); overflow: hidden;
}
.md .md-table th, .md .md-table td {
  border: 1px solid var(--border-subtle); padding: 6px 9px; text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;          /* uzun so'z/havola qatorni cho'zmasin */
}
/* Birinchi ustun (odatda nom) tor qolmasin, oxirgisi (izoh) esa qolgan
   joyni egallasin — `fixed` da hamma ustun teng bo'lib qolardi. */
.md .md-table th:first-child, .md .md-table td:first-child { width: 22%; }
.md .md-table th:last-child, .md .md-table td:last-child { width: auto; }
.md .md-table th { background: var(--surface-nav); color: var(--text-strong); font-weight: 600; }

/* kompozitor */
.chat-form {
  flex: 0 0 auto; padding: 12px 16px 10px;
  background: var(--surface-nav); border-top: 1px solid var(--border);
}
.composer {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 5px 6px 5px 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.composer:focus-within {
  border-color: var(--primary-line); background: var(--surface-raised);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.composer textarea {
  flex: 1; min-width: 0; background: none; border: 0; resize: none;
  padding: 8px 4px; min-height: 22px; max-height: 132px; overflow-y: auto;
  font-size: 13.5px; line-height: 1.5; color: var(--text-strong);
}
.composer textarea::-webkit-scrollbar { width: 6px; }
.composer textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1); border-radius: 6px;
}
/* Enter/Shift+Enter eslatmasi */
.composer-hint {
  max-width: 760px; margin: 6px auto 0; padding: 0 4px;
  font-size: 11px; color: var(--text-faint); text-align: right;
}
.composer-hint kbd {
  font-family: var(--mono); font-size: 10.5px; padding: 1px 4px;
  border: 1px solid var(--border-subtle); border-radius: 4px; color: var(--text-muted);
}
.composer textarea:focus { outline: none; }
.composer textarea:focus-visible { box-shadow: none; }
.composer textarea::placeholder { color: var(--text-faint); }

.emoji-btn {
  flex: 0 0 auto; width: 32px; height: 32px; margin-bottom: 1px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted);
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.emoji-btn:hover { background: var(--surface); color: var(--text-strong); }
.emoji-btn.on { background: var(--primary-soft); color: var(--primary); }

.send-btn {
  flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--primary); color: #fff;
  transition: background var(--t-fast), color var(--t-fast);
}
.send-btn:hover:not(:disabled) { background: var(--primary-hover); }
.send-btn:disabled { background: var(--surface); color: var(--text-faint); cursor: default; }
.send-btn.busy { background: var(--surface); color: var(--text-muted); }
.send-btn.stop { background: var(--text-strong); color: var(--bg); }
.send-btn.stop:hover { background: #fff; }

/* emoji paneli */
.emoji-pop {
  max-width: 760px; margin: 0 auto 8px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.emoji-tabs {
  display: flex; gap: 2px; padding: 6px 8px;
  background: var(--surface-nav); border-bottom: 1px solid var(--border-subtle);
}
.emoji-tab {
  border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1;
  padding: 6px 9px; border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.emoji-tab:hover { background: var(--surface-raised); }
.emoji-tab.on { background: var(--primary-soft); }
.emoji-grid {
  display: grid; grid-template-columns: repeat(11, 1fr); gap: 2px;
  padding: 8px; max-height: 232px; overflow-y: auto;
}
.emoji-cell {
  border: 0; background: none; cursor: pointer; font-size: 19px; line-height: 1;
  padding: 6px 0; border-radius: var(--r-sm);
  transition: background var(--t-fast), transform var(--t-fast);
}
.emoji-cell:hover { background: var(--surface-raised); transform: scale(1.12); }

/* suhbatlar tarixi */
.hist-row {
  position: relative; padding: 10px 12px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: var(--r); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.hist-row:hover { background: var(--surface-raised); }
.hist-row.sel { background: var(--primary-soft); border-color: var(--primary-line); }
.hist-row.sel::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.hist-title {
  font-size: 12.5px; color: var(--text); margin-bottom: 5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hist-row.sel .hist-title { color: var(--text-strong); }
.hist-meta { display: flex; align-items: center; gap: 6px;
             font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.hist-meta .dot { color: #3A3B47; }
.hist-live { width: 6px; height: 6px; border-radius: 50%; background: var(--success);
             animation: pulse 1.6s ease-in-out infinite; }
.hist-del {
  margin-left: auto; background: none; border: 0; color: var(--text-faint); cursor: pointer;
  font-size: 13px; padding: 0 2px; opacity: 0; transition: opacity var(--t-fast),
  color var(--t-fast);
}
.hist-row:hover .hist-del { opacity: 1; }
.hist-del:hover { color: var(--danger); }

/* ============================================================== dialog === */
dialog {
  border: 0; padding: 0; background: transparent; color: var(--text);
}
dialog::backdrop { background: rgba(6, 7, 10, .72); }
.dlg {
  width: min(560px, 92vw); padding: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.dlg h2 { margin: 0 0 5px; font-size: 15px; font-weight: 600; color: var(--text-strong); }
.dlg-sub { margin: 0 0 13px; font-size: 12.5px; color: var(--text-muted); }
.dlg textarea {
  width: 100%; padding: 11px 12px; border-radius: var(--r);
  background: var(--surface-sunken); border: 1px solid var(--border); color: var(--text-strong);
  font-family: var(--mono); font-size: 12px; line-height: 1.6; resize: vertical;
}
.dlg textarea:focus { outline: none; border-color: var(--primary-line); }
.dlg-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }

/* =============================================================== toast === */
#toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 10px 14px; border-radius: var(--r);
  background: var(--surface-raised); border: 1px solid var(--border);
  color: var(--text-strong); font-size: 12.5px;
  animation: toast-in var(--t);
}
.toast.bad { border-color: var(--danger-line); background: var(--danger-soft); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ========================================================== sozlamalar === */
.cfg-page { background: var(--bg); min-height: 100vh; }
.cfg-top {
  display: flex; align-items: center; gap: 14px; height: var(--topbar-h); padding: 0 18px;
  background: var(--surface-nav); border-bottom: 1px solid var(--border-subtle);
}
.cfg-back {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px;
  border-radius: var(--r-sm); color: var(--text-muted); text-decoration: none; font-size: 12.5px;
  transition: background var(--t-fast), color var(--t-fast);
}
.cfg-back:hover { background: var(--surface-raised); color: var(--text-strong); }
.cfg-top h1 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.cfg-main { max-width: 800px; margin: 0 auto; padding: 32px 20px 64px; }

/* --- sahifa sarlavhasi --------------------------------------------------- */
.cfg-hero { margin-bottom: 36px; }
.cfg-title { margin: 0 0 8px; font-size: 24px; font-weight: 600; letter-spacing: -.015em;
             color: var(--text-strong); }
.cfg-lead { max-width: 680px; margin: 0; font-size: 13.5px; line-height: 1.65;
            color: var(--text-muted); }
.cfg-lead b { color: var(--text); font-weight: 600; }

/* --- bo'lim -------------------------------------------------------------- */
.cfg-sec { margin-bottom: 36px; }
.cfg-sec:last-child { margin-bottom: 0; }
.cfg-sec-head { margin-bottom: 14px; }
.cfg-sec-head h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600;
                   letter-spacing: -.01em; color: var(--text-strong); }
.cfg-sec-note { max-width: 700px; margin: 0; font-size: 13px; line-height: 1.6;
                color: var(--text-muted); }
.cfg-sec-note b { color: var(--text); font-weight: 600; }
.cfg-sec-note code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px;
                     font-family: var(--mono); font-size: 11.5px; color: var(--text); }

/* --- token kartasi ------------------------------------------------------- */
.cfg-card {
  margin-bottom: 16px; padding: 20px;
  background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
.cfg-card:last-child { margin-bottom: 0; }
.cfg-card--table { padding: 4px 0; overflow: hidden; }
.cfg-card-top { display: flex; align-items: center; justify-content: space-between;
                gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.cfg-card-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cfg-card-id b { font-size: 14.5px; font-weight: 600; color: var(--text-strong); }
.cfg-masked { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cfg-hint { margin: 0 0 10px; font-size: 13px; line-height: 1.55; color: var(--text-muted); }
/* Fayl yo'li — yengil «code chip», matn oqimidan ajralib tursin */
.cfg-where {
  display: inline-block; margin: 0 0 14px; padding: 4px 8px;
  background: var(--surface-sunken); border-radius: 6px;
  font-size: 11.5px; color: var(--text-faint); overflow-wrap: anywhere;
}

/* --- input + tugma guruhi ------------------------------------------------ */
.cfg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cfg-row input {
  flex: 1 1 220px; min-width: 0; height: 38px; padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken); border: 1px solid var(--border); color: var(--text-strong);
  font-family: var(--mono); font-size: 12.5px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.cfg-row input::placeholder { color: var(--text-faint); }
.cfg-row input:focus { outline: none; border-color: var(--primary-line);
                       box-shadow: 0 0 0 3px var(--primary-soft); }
.cfg-row .btn { height: 38px; flex: 0 0 auto; }
.cfg-warn {
  margin: 0 0 14px; padding: 13px 15px; border-radius: var(--r);
  background: var(--warning-soft); border: 1px solid var(--warning-line);
  color: var(--warning-hover); font-size: 12.5px; line-height: 1.6;
}
.cfg-warn b { color: var(--warning); }
.cfg-warn code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px;
                 font-family: var(--mono); font-size: 11.5px; }

.tg-scroll { overflow-x: auto; }
.tg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tg-table th {
  text-align: left; padding: 12px 14px; font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
}
.tg-table th.num, .tg-table td.num { text-align: right; }
.tg-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle; color: var(--text);
}
.tg-table tbody tr:last-child td { border-bottom: none; }
.tg-table tbody tr { transition: background var(--t-fast); }
.tg-table tbody tr:hover { background: var(--surface-raised); }
.tg-table td .badge { cursor: pointer; }
.tg-name { display: inline-flex; align-items: center; gap: 7px; color: var(--text-strong);
           font-weight: 500; }
/* Yoqilgan guruh — nom yonida kichik yashil nuqta */
.tg-table tr.on .tg-name::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); flex: 0 0 auto;
}
.tg-kind { display: block; margin-top: 2px; font-style: normal; font-size: 11px;
           color: var(--text-faint); }
.tg-act { text-align: right; white-space: nowrap; }
.cfg-empty-row { padding: 18px 20px; margin: 0; }

.cfg-result { margin: 12px 0 0; font-size: 12.5px; min-height: 16px; }
.cfg-result.ok { color: var(--success); }
.cfg-result.bad { color: var(--danger); }

/* =============================================================== login === */
.login-page {
  display: grid; place-items: center; min-height: 100vh;
  background: var(--bg);
}
.login-card {
  width: min(360px, 92vw); padding: 26px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 12px;
}
.login-card .brand { display: flex; align-items: center; }
.login-card .logo { width: 30px; height: 30px; background: var(--primary-soft);
                    border-radius: var(--r); }
.login-card .sub { margin: 0 0 4px; font-size: 12.5px; color: var(--text-muted); }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px;
                    color: var(--text-muted); }
.login-card input {
  padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--surface-sunken); border: 1px solid var(--border); color: var(--text-strong);
  font-size: 13.5px;
}
.login-card input:focus { outline: none; border-color: var(--primary); }
.login-card .btn { height: 36px; margin-top: 4px; }
.msg.error {
  padding: 8px 11px; border-radius: var(--r-sm); font-size: 12.5px;
  background: var(--danger-soft); border: 1px solid var(--danger-line); color: #FCA5A5;
}

/* ========================================================== responsive === */
@media (max-width: 1280px) {
  :root { --side-w: 220px; }
  .list-pane { flex: 0 1 340px; min-width: 300px; }
  .history-pane { flex-basis: 290px; }
}

/* header: joy torayganda avval preview ixchamlashadi, rejimlar ajralmaydi */
@media (max-width: 1200px) {
  .cap-body { min-width: 92px; }
  .cap-name, .cap-unit { display: none; }     /* «15 / 22 · 7 ta bo'sh» */
  .cap-free::before { content: "· "; color: var(--text-faint); }
}

@media (max-width: 1020px) {
  .mode-opt span { display: none; }           /* segmentda ikonka + qiymat qoladi */
  .mode-opt { padding: 0 10px; }
  .mode-opt b { border-left: 0; padding-left: 0; }
}

@media (max-width: 1080px) {
  .content { flex-direction: column; }
  .list-pane { flex: 0 0 auto; min-width: 0; max-width: none; max-height: 44vh; }
  .list-pane::after { display: none; }        /* tor ekranda fade ortiqcha */
  .detail-pane { flex: 1 1 auto; min-height: 320px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .block { margin-bottom: 18px; }
  .block-body { padding: 13px; }
  .steps { padding: 12px 12px 12px 6px; }
  .step { padding-bottom: 16px; }
  /* suhbat yuqorida, tarix pastda — kichik ekranda muhimi ko'rinib tursin */
  .chat-content { flex-direction: column; }
  .chat-pane { min-height: 55vh; }
  .history-pane { flex: 0 0 auto; max-width: none; max-height: 26vh; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: 264px;
    transform: translateX(-100%); transition: transform var(--t);
    box-shadow: 0 0 0 1px var(--border);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(6, 7, 10, .6);
  }
  .side-toggle { display: inline-flex; }
  .top-title p { display: none; }
  .hdr-controls { gap: 8px; }
  .content { padding: 8px; gap: 8px; }
  .chat-scroll { padding: 12px 12px 16px; }
  .msg-main { max-width: 85%; }
  .ava { width: 24px; height: 24px; font-size: 11px; }
  .ava.bot svg { width: 12px; height: 12px; }
  .emoji-grid { grid-template-columns: repeat(8, 1fr); }
}

@media (max-width: 560px) {
  .stat-row { grid-template-columns: minmax(0, 1fr); }
  .detail { padding: 13px 13px 16px; }
  .topbar { gap: 7px; padding: 0 10px; }
  .cta span { display: none; }                /* CTA — faqat ikonka */
  .cta { padding: 0 12px; }
  .cap-status { display: none; }              /* eng tor ekranda sig'im sidebarda qoladi */
}

/* harakatni kamaytirish so'ralgan bo'lsa — animatsiyalar o'chadi */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}


/* ======================================================= fayl biriktirish */
.attach-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 10px 0;
}
.chip-file {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 220px; padding: 5px 8px;
  background: var(--surface-2, #1B1C23);
  border: 1px solid var(--border, #2A2C36);
  border-radius: 8px;
  font-size: 12.5px; color: var(--text-2, #A8ADBD);
}
.chip-file.loading { opacity: .7; font-style: italic; }
.chip-file img {
  width: 26px; height: 26px; object-fit: cover; border-radius: 5px; display: block;
}
.chip-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px;
}
.chip-x {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  color: var(--text-3, #6C7183); font-size: 15px; line-height: 1;
  transition: color .15s ease;
}
.chip-x:hover { color: var(--danger, #EF4444); }

.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 8px; text-decoration: none;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  color: inherit; font-size: 12.5px; max-width: 220px;
  transition: border-color .15s ease, transform .15s ease;
}
.msg-file:hover { border-color: var(--primary, #3B82F6); transform: translateY(-1px); }
.msg-file.img { padding: 0; border: 0; background: none; }
.msg-file.img img {
  max-width: 260px; max-height: 220px; border-radius: 8px; display: block;
  border: 1px solid rgba(255, 255, 255, .1);
}

/* sudrab tashlash holati */
.chat-pane.drop-on { outline: 2px dashed var(--primary, #3B82F6); outline-offset: -6px; }
.chat-pane.drop-on::after {
  content: "Faylni shu yerga tashlang";
  position: absolute; inset: auto 0 78px 0; text-align: center;
  font-size: 13px; color: var(--primary, #3B82F6); pointer-events: none;
}
@media (max-width: 560px) {
  .msg-file.img img { max-width: 180px; max-height: 160px; }
  .chip-file { max-width: 160px; }
}


/* ============================================ xabarga javob (reply) */
.quote {
  display: block; margin: 0 0 8px; padding: 6px 10px; cursor: pointer;
  border-left: 3px solid var(--primary, #3B82F6);
  background: rgba(59, 130, 246, .10);
  border-radius: 0 6px 6px 0; font-size: 12.5px; line-height: 1.45;
  transition: background .15s ease;
}
.quote:hover { background: rgba(59, 130, 246, .18); }
.quote b { display: block; color: var(--primary, #3B82F6); font-size: 12px; }
.quote-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--text-2, #A8ADBD);
}
.bubble.me .quote {
  border-left-color: rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .14);
}
.bubble.me .quote b,
.bubble.me .quote-text { color: rgba(255, 255, 255, .92); }

.msg-row.flash .bubble { animation: flash-msg 1.2s ease; }
@keyframes flash-msg {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
  25% { box-shadow: 0 0 0 3px rgba(59, 130, 246, .55); }
}

/* xabar tugmalari — pufakning YONIDA, matnni to'smaydi */
.msg-tools {
  position: absolute; top: 0; display: flex; gap: 4px;
  /* `padding` — pufak bilan tugmalar orasidagi ko'rinmas ko'prik:
     sichqoncha yo'lda hover'ni yo'qotmaydi */
  padding: 2px 8px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast);
}
/* hover butun qatorda ushlanadi — tugmaga yetguncha yo'qolmaydi */
.msg-row:hover .msg-tools,
.msg-tools:hover,
.msg-tools:focus-within { opacity: 1; pointer-events: auto; }
.bubble.me .msg-tools { right: 100%; }
.bubble.agent .msg-tools { left: 100%; }

.msg-tools .msg-copy,
.msg-tools .msg-reply {
  position: static; opacity: 1;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-raised); color: var(--text-muted);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.msg-tools .msg-copy:hover,
.msg-tools .msg-reply:hover {
  color: var(--text-strong); border-color: var(--primary); background: var(--surface);
}

/* tor ekran: yonida joy yo'q — pufak ichining yuqori burchagiga qaytadi */
@media (max-width: 760px) {
  .bubble.me .msg-tools { right: 2px; left: auto; padding: 2px; }
  .bubble.agent .msg-tools { left: auto; right: 2px; padding: 2px; }
  .msg-tools .msg-copy,
  .msg-tools .msg-reply { width: 22px; height: 22px; }
}

.reply-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 0 10px 6px; padding: 7px 10px;
  border-left: 3px solid var(--primary, #3B82F6);
  background: var(--surface-2, #1B1C23);
  border-radius: 0 8px 8px 0;
}
.reply-body { flex: 1; min-width: 0; font-size: 12.5px; }
.reply-body b { display: block; color: var(--primary, #3B82F6); font-size: 12px; }
.reply-body .quote-text { -webkit-line-clamp: 1; }

/* ============================================ rasmni kattalashtirib ochish */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center; padding: 32px;
  background: rgba(8, 9, 12, .88); backdrop-filter: blur(3px);
  animation: lb-in .15s ease;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: min(1400px, 94vw); max-height: 92vh;
  border-radius: 10px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  cursor: zoom-out;
}
.lb-close {
  position: absolute; top: 18px; right: 22px;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border, #2A2C36); background: var(--surface-2, #1B1C23);
  color: var(--text-1, #E6E8EF); font-size: 22px; line-height: 1;
  transition: border-color .15s ease, color .15s ease;
}
.lb-close:hover { border-color: var(--danger, #EF4444); color: var(--danger, #EF4444); }

/* rasm pufakdan chiqib ketmasin */
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; max-width: 100%; }
.msg-row.me .msg-files { justify-content: flex-end; }
.msg-file.img {
  padding: 4px; border-radius: 12px;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  transition: border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.msg-file.img:hover {
  border-color: var(--primary-line); background: var(--surface);
  transform: translateY(-1px);
}
.msg-file.img img {
  max-width: min(340px, 100%); max-height: 260px;
  width: auto; height: auto; display: block; border-radius: 9px;
  border: 0; object-fit: cover; cursor: zoom-in;
}


/* «Ishga tushmoqda» — tugma kutish holatida */
.btn.waiting {
  opacity: .85; cursor: progress;
  animation: btn-pulse 1.1s ease-in-out infinite;
}
@keyframes btn-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}


/* ======================================= «Yangi xabarlar ↓» pill */
.chat-pane { position: relative; }
.new-pill {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 5; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 20px; cursor: pointer;
  background: var(--primary); color: #fff; border: 0;
  font-size: 12px; font-weight: 500;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  animation: pill-in .18s ease;
}
.new-pill:hover { background: var(--primary-hover); }
@keyframes pill-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ======================================= tor ekran */
@media (max-width: 760px) {
  .ava { width: 28px; height: 28px; }
  .msg-main { max-width: 85%; }
  .msg-row { gap: 9px; }
  .chat-form { padding: 10px 10px 8px; }
  .composer { border-radius: 12px; }
  .composer-hint { display: none; }
  .msg-file.img img { max-width: 220px; max-height: 190px; }
}


/* ============ Qaror kutayotgan MR — ajralib turadigan amber karta ========
   Maqsad: bu karta ro'yxatda darhol ko'zga tashlansin, lekin toza va
   professional qolsin. Uch belgi: aniq amber ramka, chapdagi qalin aksent
   va chegara bo'ylab sekin o'tadigan yorug'lik. */
:root {
  --wait-line:  #FFC93C;                    /* amber ramka */
  --wait-glow:  rgba(255, 201, 60, .22);
  --wait-tint:  rgba(255, 201, 60, .06);    /* juda yengil issiq tus */
}

.mr-row.awaiting {
  position: relative;
  isolation: isolate;
  margin: 8px 7px;
  border: 1px solid var(--wait-line);
  border-left: 3px solid var(--wait-line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(90deg, var(--wait-tint), transparent 42%),
    var(--surface);
  box-shadow: 0 0 0 1px rgba(255, 201, 60, .10), 0 2px 14px -6px var(--wait-glow);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
  overflow: hidden;
}
.mr-row.awaiting + .mr-row { border-top-color: transparent; }
.mr-row.awaiting > * { position: relative; z-index: 2; }

/* chegara bo'ylab sekin o'tadigan yorug'lik — diqqatni tortadi, bezovta qilmaydi */
.mr-row.awaiting::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg,
      transparent 0%, transparent 38%,
      rgba(255, 246, 214, .16) 47%,
      rgba(255, 201, 60, .24) 51%,
      rgba(255, 246, 214, .14) 55%,
      transparent 64%, transparent 100%);
  background-size: 260% 100%;
  animation: wait-sheen 3.4s ease-in-out infinite var(--flame-delay, 0s);
  will-change: background-position;
}
@keyframes wait-sheen {
  0%        { background-position: 130% 0; }
  55%, 100% { background-position: -30% 0; }
}

.mr-row.awaiting:hover {
  border-color: #FFD966;
  box-shadow: 0 0 0 1px rgba(255, 201, 60, .18), 0 3px 18px -6px rgba(255, 201, 60, .34);
}
.mr-row.awaiting.sel {
  background: linear-gradient(90deg, var(--wait-tint), transparent 42%), var(--primary-soft);
}

@media (prefers-reduced-motion: reduce) {
  .mr-row.awaiting::after { animation: none; background: none; }
}

/* «Stend bor» belgisi — bu MR yangi preview sloti kutmaydi */
.has-srv {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 5px; cursor: help;
  background: var(--success-soft); border: 1px solid var(--success-line);
  color: var(--success);
}


/* Stenddagi test ma'lumoti — keyingi reviewer uchun yo'riqnoma */
.test-data {
  margin: 12px 0 0; padding: 11px 13px;
  border: 1px solid var(--success-line); border-radius: var(--r);
  background: var(--success-soft);
}
.test-data.warn { border-color: var(--warning-line); background: var(--warning-soft); }
.test-data.warn .td-head { color: var(--warning); }
.test-data .td-head {
  font-size: 12px; font-weight: 600; color: var(--success); margin-bottom: 6px;
}
.test-data .md { font-size: 12.5px; }


/* ===================================== klaviatura bilan navigatsiya */
.mr-row:focus-visible,
.side-item:focus-visible,
.btn:focus-visible,
.lf:focus-visible,
.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}
.mr-row:focus-visible { background: var(--surface-raised); }

/* ===================================== tafsilot: yumshoqroq scroll */
.detail-pane .pane-body { scroll-behavior: smooth; }
.detail-pane .pane-body::-webkit-scrollbar { width: 6px; }
.detail-pane .pane-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .08); border-radius: 6px;
}
.detail-pane .pane-body:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); }


/* Sidebar: «qaror kutmoqda» — alohida sariq belgi, asosiy sondan oldin */
.side-count.wait {
  background: var(--warning-soft); border: 1px solid var(--warning-line);
  color: var(--warning); font-weight: 600;
  animation: wait-glow 2.4s ease-in-out infinite;
}
@keyframes wait-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .35); }
  50%      { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}
@media (prefers-reduced-motion: reduce) { .side-count.wait { animation: none; } }
.app.collapsed .side-count.wait { display: none; }


/* «O'tkazib yuborildi» — neytral, e'tibor tortmaydigan holat */
.badge.skip { background: var(--surface-raised); border-color: var(--border);
              color: var(--text-faint); }


/* Tugma yuklanish holati — ikonka o'rniga spinner, eni o'zgarmaydi */
.btn-spin {
  width: 15px; height: 15px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: btn-spin 700ms linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spin { animation-duration: 2s; } }


/* Chatda eski xabarlar va suhbatlar ro'yxatida «yana yuklash» */
.chat-older, .hist-more, .steps-older {
  margin: 4px auto 10px; padding: 6px 14px; width: fit-content;
  border-radius: 20px; cursor: pointer;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  font-size: 11.5px; color: var(--text-muted);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.chat-older:hover, .hist-more:hover, .steps-older:hover {
  color: var(--text-strong); border-color: var(--border);
}
.steps-older { margin: 0 auto 12px; }
.hist-more { margin: 8px auto; }


/* Claude limiti: tugma o'rnida ko'rinadigan izoh */
.limit-note {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 38%, transparent);
  color: var(--warning); font-size: 13px; font-weight: 600;
}


/* ===================== Claude tokenlari (ko'plik, navbat bilan) ========== */
.tok-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex;
            flex-direction: column; gap: 10px; }
.tok {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--r);
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  transition: border-color var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}
.tok.dragging { opacity: .45; border-style: dashed; }
.tok.off { opacity: .55; }
/* Hozir ishlayotgan token — to'liq ramka emas, chapda nozik accent chiziq */
.tok.active {
  background: color-mix(in srgb, var(--success) 6%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--success) 22%, var(--border-subtle));
}
.tok.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--success);
}
.tok-grip { cursor: grab; color: var(--text-faint); font-size: 15px; line-height: 1;
            user-select: none; flex: 0 0 auto; }
.tok-grip:active { cursor: grabbing; }
.tok-pos {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-sunken); color: var(--text-muted);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
}
.tok.active .tok-pos { background: var(--success-soft); color: var(--success); }
.tok-main { flex: 1 1 auto; min-width: 0; }
.tok-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tok-head b { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.tok-sub { margin-top: 4px; font-size: 11.5px; color: var(--text-faint);
           overflow-wrap: anywhere; }
.tok-err { margin-top: 5px; font-size: 11.5px; color: var(--danger);
           overflow-wrap: anywhere; }
.tok-acts { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.tok-acts .btn { height: 32px; padding: 0 11px; font-size: 12px; }
.tok-add { margin-top: 4px; }
.tok-add #tok-name { flex: 0 1 220px; }
.tok-add #tok-value { flex: 2 1 280px; }
.cfg-empty { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }
.badge.mut { background: var(--surface-sunken); color: var(--text-muted); }

/* Sozlamalar sahifasidagi badge'lar bir xil balandlik va paddingda —
   qatorlar ko'zga bir tekis ko'rinsin. */
.cfg-card-id .badge, .tok-head .badge, .tg-table .badge {
  height: 22px; padding: 0 9px; border-radius: 999px; font-size: 10.5px;
}

@media (max-width: 640px) {
  .cfg-main { padding: 24px 14px 48px; }
  .cfg-title { font-size: 21px; }
  .cfg-card { padding: 16px; }
  .cfg-card-top { align-items: flex-start; }
  /* Input va tugmalar tik joylashsin — siqilib ketmasin */
  .cfg-row { flex-direction: column; align-items: stretch; }
  .cfg-row input, .cfg-row .btn { width: 100%; flex: 1 1 auto; }
  .tok { flex-wrap: wrap; }
  .tok-main { flex: 1 1 100%; order: 2; }
  .tok-acts { width: 100%; order: 3; }
  .tok-acts .btn { flex: 1 1 auto; }
  .tg-table { min-width: 620px; }   /* jadval gorizontal suriladi */
}


/* ---- GitLab aloqa ogohlantirishi -------------------------------------- */
/* Navbat bo'sh ko'rinishi aldamchi: sabab GitLab tomonda bo'lishi mumkin. */
.gl-alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 var(--pad, 16px) 10px;
  padding: 10px 12px;
  border: 1px solid var(--danger); border-radius: var(--radius, 10px);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.gl-alert svg { flex: none; margin-top: 1px; }
.gl-alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gl-alert-body b { font-size: 13px; }
.gl-alert-body span { font-size: 12px; color: var(--text-dim); word-break: break-word; }
