
.gm-analytics-portal {
  position: fixed; inset: 0; height: 100dvh; z-index: 1200;
  background: var(--bg2, #f7f9ff); color: var(--ink);
  display: flex; flex-direction: row; overflow: hidden;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
}
.gm-os-backdrop { display: none; }
.gm-os-sidebar {
  width: 264px; background: #0f172a; color: #f8fafc;
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08); z-index: 20; transition: transform 0.25s ease;
}
html[data-theme="dark"] .gm-os-sidebar { background: #070b16; }
.gm-os-brand { padding: 15px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); display: flex; align-items: center; justify-content: space-between; }
.gm-os-user { padding: 12px 14px; margin: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.gm-os-nav { flex: 1; padding: 4px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.gm-os-nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 10px; border: 0; background: transparent;
  color: #94a3b8; font: 600 12.5px "Bricolage Grotesque", sans-serif; cursor: pointer; transition: 0.18s;
}
.gm-os-nav-btn:hover { background: rgba(255, 255, 255, 0.06); color: #f1f5f9; }
.gm-os-nav-btn.active { background: linear-gradient(135deg, var(--ac), var(--ac2)); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4); }
.gm-os-nav-badge { margin-left: auto; padding: 2px 7px; border-radius: 99px; font-size: 10px; font-weight: 800; background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.gm-os-nav-btn.active .gm-os-nav-badge { background: rgba(255, 255, 255, 0.22); color: #fff; }
.gm-os-foot { padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 5px; }
.gm-os-main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100dvh; overflow: hidden; }
.gm-os-topbar { padding: 12px 22px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; }
.gm-os-content { flex: 1; overflow-y: auto; padding: 18px 22px 48px; scrollbar-width: thin; }
.gm-os-container { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; animation: in 0.25s ease both; }
.gm-ap-hero {
  background: linear-gradient(125deg, #1e1b4b 0%, var(--ac) 55%, var(--ac2) 100%);
  color: #fff; border-radius: 20px; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.gm-ap-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.gm-ap-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 15px; display: flex; align-items: center; gap: 12px; }
.gm-ap-kpi-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--tint); color: var(--ac); display: grid; place-items: center; font: 800 19px "Bricolage Grotesque", sans-serif; flex-shrink: 0; }
.gm-ap-grid2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.gm-ap-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.gm-ap-card h3 { margin: 0 0 12px; font: 800 16px "Bricolage Grotesque", sans-serif; color: var(--ink); text-transform: none; }
.gm-cartesian-wrap { width: 100%; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 8px; }
.gm-week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 10px; }
.gm-rank-ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.gm-err-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--bad); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; transition: 0.25s; }
.gm-err-card.fixed { border-left-color: var(--ok); background: var(--okbg); transform: scale(0.98); opacity: 0.4; }

/* Yig'iladigan Mavzular Xaritasi (Accordion Chapters) */
.gm-map-ch { border: 1px solid var(--line); border-radius: 13px; background: var(--soft); overflow: hidden; }
.gm-map-ch-head {
  width: 100%; border: 0; background: none; color: var(--ink); text-align: left;
  padding: 11px 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.gm-map-ch-head:hover { background: rgba(79, 70, 229, 0.04); }
.gm-map-ch-body { padding: 0 14px 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
.gm-map-ch.collapsed .gm-map-ch-body { display: none; }
.gm-map-ch.collapsed .gm-map-chev { transform: rotate(-90deg); }

.gm-os-mob-btn { display: none; }
@media (max-width: 900px) { .gm-ap-grid2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .gm-os-sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-105%); box-shadow: 0 0 40px rgba(0, 0, 0, 0.5); }
  .gm-analytics-portal.nav-open .gm-os-sidebar { transform: translateX(0); }
  .gm-os-backdrop { display: none; }
  .gm-analytics-portal.nav-open .gm-os-backdrop { position: fixed; inset: 0; display: block; background: rgba(15, 23, 42, 0.55); z-index: 15; backdrop-filter: blur(2px); }
  .gm-os-mob-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); font-size: 18px; cursor: pointer; }
  .gm-os-content { padding: 14px 12px 40px; }
  .gm-os-topbar { padding: 10px 14px; }
}
@media(max-width:600px){
  .gm-os-topbar > div:first-child > b { max-width:52vw; overflow:hidden; font-size:13.5px!important; text-overflow:ellipsis; white-space:nowrap; }
  .gm-os-topbar .swp-b { display:none; }
  .gm-ap-kpis { grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:8px!important; }
  .gm-ap-kpi { min-width:0; padding:11px 10px; gap:8px; }
  .gm-ap-kpi-ic { width:34px; height:34px; font-size:16px; }
  .gm-ap-hero { padding:15px 16px; border-radius:16px; }
  .gm-ap-hero button { width:100%; justify-content:center; }
  .gm-week-grid { gap:4px; }
  .gm-week-day { padding:7px 2px; border-radius:9px; }
  .gm-week-day > * { font-size:9.5px; }
  .gm-err-card > div:last-child { display:flex!important; width:100%; }
  .gm-err-card input { flex:1; min-width:0; width:auto!important; font-size:16px!important; }
}
@media(max-width:540px){
  .gm-rank-ladder { grid-template-columns:1fr; gap:8px; }
}
/* =========================================================
   TAQDIMOT UCHUN MUKAMMAL MOBIL & DESKTOP PAKETI (v20 FINAL)
   ========================================================= */

html, body {
  overflow-x: clip !important;
  -webkit-tap-highlight-color: transparent;
}

/* 1. DESKTOP (NOUTBUK): Markaziy mavzu scroll bo'lsa ham yon panellar joyida qoladi */
@media (min-width: 861px) {
  .wrap {
    display: grid !important;
    grid-template-columns: 290px minmax(0, 1fr) 320px !important;
    align-items: start !important;
  }
  #toc {
    position: sticky !important;
    top: 72px !important;
    max-height: calc(100dvh - 86px) !important;
    overflow-y: auto !important;
    z-index: 4 !important;
    transform: none !important;
  }
  #rt {
    position: sticky !important;
    top: 72px !important;
    height: calc(100dvh - 86px) !important;
    max-height: calc(100dvh - 86px) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 4 !important;
    transform: none !important;
    visibility: visible !important;
  }
}

/* Reytingda "Umumiy/Guruhim"ni yashirish va "Siz" qatori boshqalarni to'smasligi */
.board-toggle { display: none !important; }
.rk-row.me {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  z-index: 1 !important;
}

/* Logotip (∑) qutisi hech qachon qisilib qolmasligi */
.top .logo {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.top .logo i {
  flex: 0 0 32px !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  margin-right: 0 !important;
}

/* =========================================================
   2. TELEFON (<= 860px): NATIVE BOTTOM-SHEET, REYTING VA PROFIL
   ========================================================= */
@media (max-width: 860px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom)) !important;
  }

  .top {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    min-height: 54px !important;
    padding: 8px 12px !important;
  }

  /* MUHIM: #toc telefonda tepada bo'sh joy hosil qilmasligi uchun fixed bo'ladi! */
  #toc {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    z-index: 95 !important;
    width: min(86vw, 330px) !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 20px 20px 0 !important;
    padding: 12px 10px calc(20px + env(safe-area-inset-bottom)) !important;
    background: var(--bg2, #f6f7fd) !important;
    transform: translateX(-105%) !important;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    overflow-y: auto !important;
  }
  body.nav-open #toc {
    transform: translateX(0) !important;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.45) !important;
  }

  /* Mundarija va Bottom-Sheet tepasidagi yopish (.dh va .rth) panellarini majburan yoqish */
  .dh {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: sticky !important;
    top: -12px !important;
    z-index: 5 !important;
    background: var(--bg2, #f6f7fd) !important;
    padding: 8px 6px 10px !important;
    border-bottom: 1px solid var(--line) !important;
    margin-bottom: 8px !important;
  }

  /* Orqa fondagi qoraytirilgan pardalar (#bk va #rbk) — bosganda oynani yopadi */
  #bk, #rbk {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 88 !important;
    background: rgba(15, 23, 42, 0.52) !important;
    backdrop-filter: blur(2px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease !important;
  }
  body.nav-open #bk,
  body.rt-open #rbk,
  body.rk-open #rbk {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* PROFIL (#rt) VA REYTING (#rkp) BOTTOM-SHEET DIZAYNI (Pastda g'alati bo'shliq qolmaydi!) */
  #rt, #rkp {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: 82dvh !important;
    z-index: 95 !important;
    padding: 0 14px calc(18px + env(safe-area-inset-bottom)) !important;
    border-radius: 22px 22px 0 0 !important;
    background: var(--bg2, #f6f7fd) !important;
    border-top: 1px solid var(--line) !important;
    overflow-y: auto !important;
    transform: translateY(105%) !important;
    visibility: hidden !important;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.28s !important;
    box-shadow: none !important;
  }
  body.rt-open #rt,
  body.rk-open #rkp {
    transform: translateY(0) !important;
    visibility: visible !important;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.35) !important;
  }

  /* Oyna tepasidagi "Profil / Reyting" + "✕" tugmasi va iPhone tutqichi */
  .rth {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: var(--bg2, #f6f7fd) !important;
    padding: 16px 4px 10px !important;
    margin-bottom: 6px !important;
    border-bottom: 1px solid var(--line) !important;
  }
  .rth::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: var(--line3, #cbd5e1);
  }
  .rth b {
    font: 800 16px "Bricolage Grotesque", sans-serif !important;
    color: var(--ink) !important;
  }
  .rth button {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 1px solid var(--line) !important;
    background: var(--card) !important;
    color: var(--ink) !important;
    font-size: 14px !important;
    display: grid !important;
    place-items: center !important;
    cursor: pointer !important;
  }

  /* #rkp ichida reyting ro'yxati to'liq ko'rinishi */
  #rkp .rk-top {
    position: sticky !important;
    top: 52px !important;
    background: var(--bg2, #f6f7fd) !important;
    padding: 6px 0 8px !important;
    z-index: 5 !important;
  }
  #rkp .rk-list {
    display: grid !important;
    gap: 7px !important;
    padding-bottom: 10px !important;
  }

  /* Misollar 2 ustunli va chapga tekislangan */
  .pg, .pg.c2, .pg.c3 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }
  .pg > div {
    display: block !important;
    text-align: left !important;
    padding: 8px 10px !important;
    font-size: 14px !important;
  }

  /* Pastki Mobil Menyu (.mb) — 5 ta aqlli tugma */
  .mb {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr)) !important;
    align-items: center !important;
    gap: 2px !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 82 !important;
    background: var(--card-a, rgba(255, 255, 255, 0.96)) !important;
    backdrop-filter: blur(12px) !important;
    border-top: 1px solid var(--line) !important;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom)) !important;
  }
  body.typing .mb {
    display: none !important;
  }
  .mb button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 5px 2px !important;
    font: 700 10px "Bricolage Grotesque", sans-serif !important;
    color: var(--mut) !important;
    border-radius: 10px !important;
    border: 0 !important;
    background: transparent !important;
  }
  .mb button.active-tab {
    color: var(--ac) !important;
    background: var(--tint) !important;
  }
  .mb button svg {
    width: 20px !important;
    height: 20px !important;
  }
}

/* =========================================================
   3. REPETITOR BLOKI (#repetitor-panel) TELEFON MOSLASHUVI
   ========================================================= */
@media (max-width: 768px) {
  #repetitor-panel header,
  #repetitor-panel > div > div:first-child {
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  #rep-page-title {
    font-size: 14.5px !important;
    max-width: 46vw !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #rep-user-info .rep-badge {
    display: none !important; /* Telefonda joy tejash uchun faqat ism qoladi */
  }
  #rep-content {
    padding: 12px 10px 36px !important;
  }
  .rep-hero {
    padding: 14px 16px !important;
  }
  .rep-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .rep-kpi-card {
    padding: 10px !important;
    gap: 8px !important;
  }
  .rep-kpi-val {
    font-size: 16px !important;
  }
  .rep-hub-bar {
    padding: 10px 12px !important;
    gap: 8px !important;
  }
  .rep-hub-bar > div {
    width: 100% !important;
    justify-content: space-between !important;
  }
  #group-quick-lesson-select {
    flex: 1 !important;
    min-width: 140px !important;
  }
  .rep-modal-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .rep-modal-box, .rep-modal-box.wide {
    width: 100% !important;
    max-height: 90dvh !important;
    border-radius: 20px 20px 0 0 !important;
  }
}

/* =========================================================
   HOTFIX v21: LOGO GAP, FORMULALAR VA TOZA LOGIN OYNASI
   ========================================================= */

/* 1. "Matematiklar .uz" orasidagi bo'sh joyni yo'qotish */
.top .logo {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
}
.top .logo i {
  margin-right: 8px !important;
}
.top .logo .lg-uz {
  margin-left: 0 !important;
}

/* 2. Formulalar va Mashq bloki kesilib yoki yashirinib qolmasligi */
#d {
  overflow: visible !important;
}
.fx, .fx.collapsible {
  overflow: visible !important;
}
.prac-set-wrap, .prac-set-body {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.prac-set-wrap.collapsed .prac-set-body {
  display: none !important;
}
div[id^="pr"] {
  display: block !important;
  min-height: 4px;
}

/* 3. Login oynasida ishlamaydigan bo'sh/Telegram tugmasini yashirish */
#login-overlay button[onclick*="telegram" i],
#login-overlay button[id*="telegram" i],
#login-overlay .tg-login-btn,
#login-overlay a[href*="t.me"] {
  display: none !important;
}