:root {
  --bg: #0b0d10;
  --bg-2: #12151a;
  --bg-3: #181c22;
  --line: #232830;
  --fg: #e8eaed;
  --muted: #8a9099;
  --accent: #4d8dff;
  --accent-2: #7eb6ff;
  --danger: #ff5c5c;
  --ok: #3ecf8e;
  --radius: 12px;
  --topbar-bg: rgba(11, 13, 16, .88);
  --btn-hover-bg: #20252d;
  --btn-hover-line: #2e343d;
}

/* Och (kunduzgi) rejim — tugma bilan yoqiladi, localStorage'da eslab qolinadi */
:root[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-2: #ffffff;
  --bg-3: #eef0f3;
  --line: #e1e4e9;
  --fg: #14161a;
  --muted: #666c76;
  --accent: #3568d4;
  --accent-2: #2554b8;
  --danger: #d13c3c;
  --ok: #17915e;
  --topbar-bg: rgba(255, 255, 255, .85);
  --btn-hover-bg: #e7e9ed;
  --btn-hover-line: #d5d9df;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; font-size: 13px; }
.center { display: grid; place-items: center; padding: 24px; }
[hidden] { display: none !important; }

/* Tugmalar va maydonlar */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg-3);
  color: var(--fg); padding: 9px 14px; border-radius: 9px; cursor: pointer;
  font: inherit; font-weight: 500; transition: .15s;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--btn-hover-bg); border-color: var(--btn-hover-line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #3f7ff0; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--bg-3); }
.btn.sm { padding: 6px 10px; font-size: 13px; }

input[type=text], input[type=password], input[type=search], select {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font: inherit; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }

/* Kirish sahifasi */
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px;
}
.auth { width: min(360px, 100%); display: grid; gap: 16px; }
.sidebar-head { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
#sidebar-close { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }

/* Logotip oq rangda chizilgan (fil0:#FEFEFE) - to'q fonda to'g'ridan-to'g'ri,
   och rejimda esa oq fonda ko'rinmay qolmasin deb ranglari teskarilanadi. */
.logo-img { height: 26px; width: auto; display: block; }
:root[data-theme="light"] .logo-img { filter: invert(1); }
.auth .logo-img { height: 30px; margin: 0 auto; }
.auth .muted { margin: -10px 0 4px; font-size: 13px; }

/* Umumiy tuzilma */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--line); background: var(--bg-2);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.nav { display: grid; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border-radius: 9px; border: 0; background: transparent;
  color: var(--muted); font: inherit; text-align: left; cursor: pointer;
}
.nav button:hover { background: var(--bg-3); color: var(--fg); }
.nav button.on { background: var(--bg-3); color: var(--fg); font-weight: 500; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Yon paneldagi belgilar - ilova ikonkalari uslubida, to'ldirilgan */
.ico {
  width: 20px; height: 20px; flex: 0 0 20px;
  border-radius: 6px;
  object-fit: cover;          /* public/icons/ dagi rasm cho'zilmasin */
  filter: saturate(.85) brightness(.92);
  transition: filter .15s, transform .15s;
}
.nav button:hover .ico,
.nav button.on .ico { filter: none; transform: scale(1.04); }

#theme-toggle, #logout { justify-content: flex-start; gap: 8px; }

/* ── Yon panelni yig'ish (faqat kompyuter) ───────────────────────────
   Yig'ilganda faqat ikonkalar qoladi, albomlar ro'yxati yashiriladi.
   Holat localStorage'da saqlanadi va sahifa chizilishidan oldin
   <html data-sidebar="collapsed"> bilan qo'yiladi (yalt etmasin). */
.logo-mark { display: none; width: 30px; height: 30px; }
#sidebar-toggle { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); padding: 5px 6px; color: var(--muted); }
#sidebar-toggle:hover { color: var(--fg); }
#sidebar-toggle svg { transition: transform .2s; }
.app { transition: grid-template-columns .2s ease; }

@media (min-width: 761px) {
  :root[data-sidebar="collapsed"] .app { grid-template-columns: 68px 1fr; }
  :root[data-sidebar="collapsed"] .sidebar { padding: 16px 10px; align-items: center; overflow-x: hidden; }
  :root[data-sidebar="collapsed"] .sidebar-head { flex-direction: column; gap: 10px; }
  :root[data-sidebar="collapsed"] .logo-img { display: none; }
  :root[data-sidebar="collapsed"] .logo-mark { display: block; }
  :root[data-sidebar="collapsed"] #sidebar-toggle { position: static; transform: none; }
  :root[data-sidebar="collapsed"] #sidebar-toggle svg { transform: rotate(180deg); }
  :root[data-sidebar="collapsed"] .nav button { justify-content: center; padding: 10px; }
  :root[data-sidebar="collapsed"] .nav .nm,
  :root[data-sidebar="collapsed"] .nav .count,
  :root[data-sidebar="collapsed"] #albums-section,
  :root[data-sidebar="collapsed"] #usage,
  :root[data-sidebar="collapsed"] #theme-label,
  :root[data-sidebar="collapsed"] #logout .btn-label { display: none; }
  :root[data-sidebar="collapsed"] #theme-toggle,
  :root[data-sidebar="collapsed"] #logout { justify-content: center; }
  :root[data-sidebar="collapsed"] .ico { width: 24px; height: 24px; flex-basis: 24px; }
}
@media (max-width: 760px) {
  .only-desktop { display: none !important; }
}
.theme-icon { flex: 0 0 auto; }
.theme-icon.sun { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon.moon { fill: currentColor; stroke: none; }

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); padding: 0 11px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between;
}

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

/* Tepa panel + tanlov paneli bitta blok bo'lib qotadi */
.head-stick { position: sticky; top: 0; z-index: 20; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar input[type=search] { max-width: 260px; }

.content { padding: 18px; flex: 1; }

/* Galereya */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(7, 1fr);
}

/* Savatcha eski (moslashuvchan) panjarada qoladi - boshqa bo'limlar kabi
   qattiq 7/4 ustunga o'tmaydi. */
.grid.trash-grid {
  grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 16vw, 190px), 1fr));
}

/* "Mening Serverim"da albom guruhlari orasidagi sarlavha - butun kenglikni egallaydi */
.grid-section {
  grid-column: 1 / -1;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 2px 2px; font-weight: 600; font-size: 14px;
  border-top: 1px solid var(--line);
}
.grid-section:first-child { border-top: 0; padding-top: 0; }
.grid-section .muted { font-weight: 400; font-size: 12px; }

.tile {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--bg-3); cursor: pointer; border: 2px solid transparent;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.sel { border-color: var(--accent); }
.tile:hover .tile-bar { opacity: 1; }

.tile .ph {
  width: 100%; height: 100%; display: grid; place-items: center; gap: 4px;
  color: var(--muted); font-size: 26px; align-content: center;
}

/* Videolar bo'limidagi kartochka. Keng ekranda oddiy kvadrat katak
   (7 ustun), telefon/planshetda esa YouTube uslubi: katta 16:9 kadr,
   o'ng pastda davomiylik, tagida nomi va ma'lumoti. */
.vcard .vthumb { position: absolute; inset: 0; }
.vcard .vinfo { display: none; }

@media (max-width: 1100px) {
  .grid.video-list:not(.trash-grid) { grid-template-columns: repeat(2, 1fr); gap: 22px 16px; }
  .grid.video-list .vcard {
    aspect-ratio: auto; background: none; border: 0; border-radius: 0; overflow: visible;
  }
  .grid.video-list .vcard .vthumb {
    position: relative; inset: auto; aspect-ratio: 16 / 9;
    border-radius: 12px; overflow: hidden; background: var(--bg-3);
    border: 2px solid transparent;
  }
  .grid.video-list .vcard.sel .vthumb { border-color: var(--accent); }
  .grid.video-list .vcard .tile-bar { display: none; }
  .grid.video-list .vcard .ph { font-size: 34px; }
  .grid.video-list .vcard .badge {
    top: auto; bottom: 8px; right: 8px; font-size: 12.5px; font-weight: 600;
    padding: 3px 7px; background: rgba(0,0,0,.78); color: #fff;
  }
  .grid.video-list .vcard .bplay { display: none; }
  .grid.video-list .vcard .vinfo { display: block; padding: 10px 2px 0; }
  .vtitle {
    font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--fg);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .vmeta { font-size: 13px; color: var(--muted); margin-top: 4px; }
}
@media (max-width: 600px) {
  .grid.video-list:not(.trash-grid) { grid-template-columns: 1fr; gap: 20px; }
}

/* Suratlar bo'limi telefon/planshetda 2 ustun - katta, ko'rish oson */
@media (max-width: 1100px) {
  .grid.photo-list:not(.trash-grid) { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid.photo-list .tile { border-radius: 12px; }
}

/* CDR ko'rish: sahifalar ustma-ust, o'zi aylantiriladi */
.cdr-view {
  width: min(900px, 100%); height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 4px 2px 20px;
}
.cdr-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.cdr-status { font-size: 13px; color: var(--muted); }
.cdr-view figure { margin: 0; display: grid; gap: 6px; justify-items: center; width: 100%; }
/* CorelDRAW ichidagi rasmlar kichik (~256px) - o'qilishi uchun kattalashtiramiz */
.viewer-body .cdr-view img {
  max-width: 100%; max-height: none; width: min(560px, 100%); height: auto;
  background: #fff; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.cdr-view figcaption { font-size: 12px; color: var(--muted); }

/* Musiqa katagi va ko'rish oynasidagi pleyer */
.tile .audio-ph { background: linear-gradient(145deg, #3a1d52, #1b1330); color: #f3b7ff; }
.tile .audio-ph svg { width: 42%; height: 42%; }
.audio-view { display: grid; place-items: center; gap: 18px; width: min(520px, 100%); }
.audio-disc {
  width: min(220px, 50vw); aspect-ratio: 1; border-radius: 24px; display: grid; place-items: center;
  background: linear-gradient(145deg, #ff7ad9, #9b3cf0); box-shadow: 0 20px 60px rgba(155,60,240,.35);
}
.audio-disc svg { width: 55%; height: 55%; }
.audio-title { font-size: 16px; font-weight: 600; text-align: center; color: var(--fg); word-break: break-word; }
.audio-view audio { width: 100%; }

/* Papka plitkasi - "Mening Serverim"da albomlarni ko'rsatish uchun.
   Fon/karta yo'q - faqat belgi. Nomi ikonka ustiga chiqib ketmasin deb,
   boshqa plitkalardan farqli holda kvadrat emas - ikonka kvadrat, nomi
   esa pastda, oddiy oqimda (overlay emas). */
.folder-tile {
  aspect-ratio: auto; background: transparent;
  display: flex; flex-direction: column;
}
.folder-tile .folder-ico {
  position: relative; aspect-ratio: 1; width: 100%;
  display: grid; place-items: center; color: var(--accent);
}
.folder-tile .folder-ico svg { width: 60%; height: 60%; }
.folder-tile .folder-ico img { width: 68%; height: 68%; object-fit: contain; }
.folder-tile:hover .folder-ico { transform: translateY(-2px); }
.folder-del {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 30px; height: 30px; border-radius: 8px; border: 0; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  background: rgba(0,0,0,.45); color: #fff; opacity: 0; transition: opacity .15s, background .15s;
}
.folder-del svg { width: 16px; height: 16px; }
.folder-del:hover { background: var(--danger); }
.folder-tile:hover .folder-del, .folder-del:focus-visible { opacity: 1; }
/* Sensorli ekranda "hover" yo'q - tugma doim ko'rinsin */
@media (hover: none) { .folder-del { opacity: .85; } }
.folder-tile .tile-bar {
  position: static; opacity: 1; background: none; padding: 6px 4px 2px;
  flex-direction: column; align-items: center; text-align: center; gap: 1px;
}
.folder-tile .tile-bar .nm { font-size: 13px; font-weight: 600; white-space: normal; }
.folder-tile .tile-bar .muted { margin-left: 0; color: var(--muted); font-size: 11.5px; }
.tile .ph .ext {
  font-size: 11px; letter-spacing: .5px; font-weight: 600;
  color: var(--muted); font-family: ui-monospace, monospace;
}
.tile-bar {
  position: absolute; inset: auto 0 0 0; padding: 20px 8px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  font-size: 11px; color: #fff; opacity: 0; transition: .15s;
  display: flex; align-items: center; gap: 6px;
}
.tile-bar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  position: absolute; top: 7px; right: 7px; padding: 2px 6px;
  border-radius: 6px; background: rgba(0,0,0,.65); font-size: 11px;
  display: flex; align-items: center; gap: 4px;
}
.fav-dot { position: absolute; top: 7px; left: 7px; font-size: 13px; }

/* Belgilash rejimi */
.chk {
  display: none; position: absolute; top: 7px; left: 7px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); background: rgba(0,0,0,.35);
}
.grid.select-mode .chk { display: block; }
.grid.select-mode .fav-dot { display: none; }
.tile.sel { border-color: var(--accent); }
.tile.sel .chk { background: var(--accent); border-color: var(--accent); }
.tile.sel .chk::after {
  content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.selbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.selbar button:disabled { opacity: .4; cursor: default; }
#sel-delete { background: rgba(255, 92, 92, .12); }
#sel-delete:hover:not(:disabled) { background: rgba(255, 92, 92, .22); }

.empty { display: grid; place-items: center; gap: 10px; padding: 70px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 40px; }

/* Yuklash */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 30px; text-align: center; color: var(--muted); margin-bottom: 16px;
}
.dropzone.hot { border-color: var(--accent); background: rgba(77,141,255,.06); color: var(--fg); }

/* Navbat: har bir fayl qatori (70%) va O'ZINING spidometri (30%) yonma-yon.
   Spidometri yo'q qatorlar (masalan Telegramga yuklash bosqichi) butun
   kenglikni egallaydi. Qator spidometr balandligiga cho'ziladi. */
.queue {
  display: grid; grid-template-columns: 7fr 3fr; gap: 10px 16px;
  margin-bottom: 16px;
}
.qitem {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  align-items: center; align-content: center; background: var(--bg-2); border: 1px solid var(--line);
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
}
.qitem.has-gauge { grid-column: 1; padding: 14px 18px; gap: 12px 14px; }
.qitem.has-gauge .nm { font-size: 15px; font-weight: 600; }
.qitem.has-gauge .st { font-size: 13px; }
.qitem.has-gauge .bar { height: 8px; border-radius: 4px; }
.qitem:has(.x), .qitem:has(.qpause) { grid-template-columns: 1fr auto auto; }
.qitem:has(.x):has(.qpause) { grid-template-columns: 1fr auto auto auto; }
.qitem .x { grid-row: 1; grid-column: 3; padding: 2px 8px; }
.qitem .qpause { grid-row: 1; grid-column: 3; padding: 2px 9px; }
.qitem:has(.x) .qpause { grid-column: 4; }
.qitem .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .st { color: var(--muted); font-size: 12px; text-align: right; }
.qitem.err .st { color: var(--danger); }
.qitem.done .st { color: var(--ok); }
.bar { grid-column: 1 / -1; height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* Tezlik ko'rsatkichi (spidometr) - har bir yuklanayotgan fayl yonida */
.gauge {
  grid-column: 2;
  display: grid; place-items: center; gap: 2px; padding: 4px 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.gauge svg { width: 100%; max-width: 170px; height: auto; }
.gauge-bg { stroke: var(--bg-3); }
.gauge-fg {
  stroke: var(--accent); stroke-dasharray: 251.33; stroke-dashoffset: 251.33;
  transition: stroke-dashoffset .4s ease;
}
.gauge-needle {
  transform-origin: 100px 110px; transform: rotate(-90deg); transition: transform .4s ease;
}
.gauge-needle line { stroke: var(--fg); }
.gauge-needle circle { fill: var(--accent); }
.gauge-value { font-size: 16px; font-weight: 700; margin-top: -8px; }
.gauge-value .muted { font-size: 12px; font-weight: 400; }
.gauge-label { font-size: 11.5px; color: var(--muted); }

/* Ko'rish oynasi */
.viewer {
  /* Media ko'rish oynasi sayt rejimidan qat'i nazar HAR DOIM to'q fonda -
     surat/video kontrasti uchun (YouTube, Google Photos ham shunday qiladi).
     Ichkaridagi barcha var(--fg)/var(--bg-3)/... shu yerda qayta belgilangani
     uchun tugmalar, matnlar och rejimda ham to'g'ri (oq-ustida-oq bo'lmaydi). */
  --bg-2: #12151a;
  --bg-3: #181c22;
  --line: #232830;
  --fg: #e8eaed;
  --muted: #8a9099;
  --btn-hover-bg: #20252d;
  --btn-hover-line: #2e343d;

  position: fixed; inset: 0 0 auto 0; z-index: 100; background: rgba(6,8,10,.97);
  /* Telefon brauzerlarida 100vh pastki panel ostiga ham kirib ketadi -
     dvh esa aynan ko'rinib turgan qism */
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
}
.viewer-top {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.viewer-top .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-top .spacer { flex: 1; }
/* Telefonda barcha tugma bir qatorga sig'maydi (✕ ekrandan chiqib ketardi):
   1-qator — nom va ✕, 2-qator — amallar (kerak bo'lsa yana ko'chadi) */
@media (max-width: 600px) {
  .viewer-top { flex-wrap: wrap; row-gap: 4px; padding: 8px 10px; }
  .viewer-top .nm { order: 0; flex: 1 1 0; min-width: 0; }
  .viewer-top [data-act="close"] { order: 1; }
  .viewer-top .spacer { order: 2; flex: 0 0 100%; height: 0; }
  .viewer-top > :not(.nm):not(.spacer):not([data-act="close"]) { order: 3; }
  .navbtn { width: 36px; height: 36px; }
  .navbtn.prev { left: 6px; }
  .navbtn.next { right: 6px; }
}
/* Grid emas, flex: grid'da rasmning max-height:100% i hisoblanmay, katta
   surat ekrandan chiqib ketardi. Flex elementi o'lchami aniq bo'lgani
   uchun foizlar to'g'ri ishlaydi. */
.viewer-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 14px; min-height: 0; position: relative; overflow: hidden;
}
.viewer-body video, .viewer-body img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: 10px; background: #000;
}
.viewer-body iframe { width: min(1000px, 100%); height: 100%; }
.viewer-info { padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted);
  display: flex; gap: 14px; flex-wrap: wrap; }
.navbtn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(20,24,30,.85); color: var(--fg); font-size: 18px; cursor: pointer;
}
.navbtn:hover { background: var(--bg-3); }
.navbtn.prev { left: 14px; }
.navbtn.next { right: 14px; }

/* Modal oyna */
.modal-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(0,0,0,.6); padding: 20px; }
.modal { width: min(520px, 100%); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; display: grid; gap: 14px; max-height: 86vh; overflow: auto; }
.modal h2 { margin: 0; font-size: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.copybox { display: grid; gap: 6px; }
.copybox code {
  display: block; padding: 9px 11px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; font-size: 12px; word-break: break-all; font-family: ui-monospace, monospace;
}

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line); padding: 10px 16px;
  border-radius: 10px; z-index: 300; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* Telefon */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 50;
    transform: translateX(-100%); transition: transform .2s;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
  .content { padding: 12px; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 10px 12px; }
  .topbar input[type=search] { max-width: none; }
  /* Telefonda OS darajasida papka tanlash cheklangan - joy tejalsin */
  #folder-btn { display: none; }
  /* Pastki tab-bar hammasini almashtiradi - yuqoridagi ☰ endi shart emas */
  #menu-btn { display: none; }
  .grid:not(.trash-grid) { grid-template-columns: repeat(4, 1fr); }
  .grid { gap: 6px; }
  /* Tor ekranda 70/30 tiqilib qolmasin - spidometr o'z qatori tagiga tushadi */
  .queue { grid-template-columns: 1fr; }
  .qitem.has-gauge, .gauge { grid-column: 1; }
  .gauge svg { max-width: 140px; }

  /* Qidiruv alohida qatorga tushadi, Belgilash/Yuklash faqat ikonka bilan qoladi */
  .topbar { flex-wrap: wrap; }
  .topbar input[type=search] {
    order: 5; flex: 1 1 100%; margin-top: 4px;
  }
  #select-btn .btn-txt, #upload-btn .btn-txt { display: none; }
  #select-btn, #upload-btn { padding: 9px 11px; }
}
@media (min-width: 761px) {
  .only-mobile { display: none !important; }
}

/* Telegram uslubidagi pastki tab-bar - faqat telefon o'lchamida */
.tabbar {
  display: none;
  position: fixed; inset: auto 0 0 0; z-index: 45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-2); border-top: 1px solid var(--line);
}
@media (max-width: 760px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); }
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px 8px; background: none; border: 0; color: var(--muted);
  font-size: 10.5px; line-height: 1.1;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.on { color: var(--accent); }
.tabbar button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* "Yuklanayotganlar" bo'limi: navbat xulosasi */
.up-sum {
  margin-bottom: 14px; padding: 12px 14px; font-size: 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.up-sum .bad { color: #ff6b6b; }
.tabbar button { position: relative; }
.tabbar #more-btn.has-up::after {
  content: ''; position: absolute; top: 5px; left: calc(50% + 6px);
  width: 9px; height: 9px; border-radius: 50%; background: #2fbf86;
}
