/* Ranglar Telegram mavzusidan olinadi: sahifa foydalanuvchi tanlagan
   ko'rinishda ochiladi. Telegram o'zgaruvchi bermasa (masalan brauzerda
   ochilsa) — ikkinchi qiymat ishlaydi. */
:root {
  --bg:      var(--tg-theme-bg-color, #ffffff);
  --panel:   var(--tg-theme-secondary-bg-color, #f2f4f6);
  --ink:     var(--tg-theme-text-color, #14191e);
  --ink-2:   var(--tg-theme-hint-color, #7a8792);
  --accent:  var(--tg-theme-button-color, #2a6fa8);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --link:    var(--tg-theme-link-color, #2a6fa8);
  --rule: color-mix(in srgb, var(--ink) 14%, transparent);
  --ok:   #2c7355;  --ok-bg:   color-mix(in srgb, #2c7355 16%, transparent);
  --risk: #a3760f;  --risk-bg: color-mix(in srgb, #a3760f 18%, transparent);
  --stop: #a83a2c;  --stop-bg: color-mix(in srgb, #a83a2c 16%, transparent);
  --idle-bg: color-mix(in srgb, var(--ink) 10%, transparent);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 12px 12px calc(24px + env(safe-area-inset-bottom));
  max-width: 46rem; margin-inline: auto;
}
h1 { font-size: 1.05rem; margin: 0; font-weight: 600; }
button { font: inherit; color: inherit; }

.top { display: flex; align-items: baseline; justify-content: space-between;
  gap: .5rem; margin-bottom: .7rem; }
.who { font-size: .78rem; color: var(--ink-2); text-align: right; }

.search { width: 100%; padding: .5rem .65rem; border-radius: .55rem;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  margin-bottom: .55rem; }
.search::placeholder { color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.chip { font-size: .76rem; padding: .25rem .6rem; border-radius: 1rem;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink-2);
  cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent);
  border-color: var(--accent); }

.row { display: flex; flex-direction: column; gap: .32rem; width: 100%;
  padding: .6rem 0; border: 0; border-bottom: 1px solid var(--rule);
  background: none; text-align: left; cursor: pointer; }
.l1 { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.nm { font-weight: 600; font-size: .92rem; }
.pc { font-size: .82rem; color: var(--ink-2); flex: none;
  font-variant-numeric: tabular-nums; }
.meta { font-size: .76rem; color: var(--ink-2); }

.bar { height: 4px; border-radius: 2px; background: var(--idle-bg); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.full > i { background: var(--ok); }

.dots { display: flex; gap: 3px; flex: none; }
.dots > b { width: 14px; height: 6px; border-radius: 2px; background: var(--idle-bg); }
.dots > b.ok { background: var(--ok); }
.dots > b.risk { background: var(--risk); }
.dots > b.stop { background: var(--stop); }
.dots > b.done { background: var(--ok); }

.pill { font-size: .72rem; font-weight: 600; padding: .1rem .42rem;
  border-radius: .28rem; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.risk { background: var(--risk-bg); color: var(--risk); }
.pill.stop { background: var(--stop-bg); color: var(--stop); }
.pill.idle { background: var(--idle-bg); color: var(--ink-2); }

.sect { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); margin: 1rem 0 .35rem; }
.kv { display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; padding: .38rem 0; border-bottom: 1px solid var(--rule); }
.kv .k { color: var(--ink-2); font-size: .84rem; }
.kv .v { font-size: .84rem; text-align: right; }

.note { font-size: .78rem; color: var(--ink-2); margin-top: .3rem; }

.file { display: flex; align-items: center; gap: .6rem; padding: .55rem;
  background: var(--panel); border: 1px solid var(--rule); border-radius: .5rem; }
.file .ic { font-size: .68rem; font-weight: 700; color: #fff; background: var(--stop);
  padding: .25rem .35rem; border-radius: .25rem; flex: none; }

.btn { display: block; width: 100%; text-align: center; padding: .6rem;
  border-radius: .55rem; border: 0; font-size: .88rem; font-weight: 600;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
  margin-top: .5rem; }
.btn.ghost { background: var(--panel); color: var(--ink);
  border: 1px solid var(--rule); }
.btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }

.chk { display: grid; grid-template-columns: 2rem 1fr; gap: .4rem;
  align-items: start; padding: .32rem 0; font-size: .86rem; }
.chk .bx { color: var(--ink-2); }
.chk.d .bx { color: var(--ok); }
.chk.p .bx { color: var(--risk); }
.chk .sub { font-size: .74rem; color: var(--ink-2); }

.lockbar { padding: .45rem .6rem; border-radius: .45rem; background: var(--risk-bg);
  color: var(--risk); font-size: .8rem; font-weight: 600; margin-bottom: .6rem; }
.msg { padding: 2rem .5rem; text-align: center; color: var(--ink-2); font-size: .9rem; }
.back { background: none; border: 0; color: var(--link); cursor: pointer;
  padding: 0; font-size: .85rem; margin-bottom: .5rem; }
[hidden] { display: none !important; }

.fmeta { flex: 1; }
.fname { font-size: .86rem; }
.fsize { font-size: .74rem; color: var(--ink-2); }

/* ---- Справка (help.html) ---- */
.doc { max-width: 42rem; }
.doc h1 { font-size: 1.35rem; margin: .2rem 0 .3rem; }
.doc .lead { color: var(--ink-2); font-size: .9rem; margin-bottom: 1rem; }
.doc h2 { font-size: 1.02rem; margin: 1.4rem 0 .1rem;
  padding-top: .9rem; border-top: 2px solid var(--ink); }
.doc h3 { font-size: .95rem; margin: 1rem 0 .35rem; font-weight: 600; }
.doc p { margin: .45rem 0; }
.doc ul, .doc ol { margin: .45rem 0; padding-left: 1.15rem; }
.doc li { margin: .22rem 0; }
.doc .tip { font-size: .86rem; color: var(--ink-2);
  border-left: 3px solid var(--accent); padding: .1rem 0 .1rem .6rem;
  margin: .5rem 0; }
.doc .tip.warn { border-left-color: var(--stop); }
.doc .tip b { color: var(--ink); }
.doc .badge { font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: .14rem .45rem; border-radius: .25rem;
  display: inline-block; margin-bottom: .3rem; }
.doc .badge.all { background: var(--idle-bg); color: var(--ink-2); }
.doc .badge.adm { background: var(--risk-bg); color: var(--risk); }
.doc kbd { font-weight: 600; background: var(--idle-bg); color: var(--ink);
  border-radius: .25rem; padding: .06rem .35rem; white-space: nowrap;
  font-size: .88em; }
.doc table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.doc th, .doc td { text-align: left; padding: .35rem .45rem;
  border-bottom: 1px solid var(--rule); vertical-align: top; }
.doc thead th { color: var(--ink-2); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em; }
.doc .wide { overflow-x: auto; margin: .5rem 0; }
.doc .toplink { display: inline-block; margin-top: 1.5rem; color: var(--link);
  font-size: .85rem; }
.doc .outro { margin-top: 1.5rem; }
.helplink { color: var(--link); font-size: .74rem; text-decoration: none; }

/* ---- amal tugmalari ---- */
.kv.tap { width: 100%; border: 0; border-bottom: 1px solid var(--rule);
  background: none; text-align: left; cursor: pointer; font: inherit; }
.kv.tap .v { color: var(--link); }
textarea.ta { width: 100%; resize: vertical; font: inherit;
  min-height: 5rem; margin-bottom: .5rem; }
.uwrap { display: block; }
.ufile { display: none; }
.uwrap .btn { margin-top: 0; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }

/* Bosiladigan katakcha. Belgi kichkina, barmoq esa katta — shuning uchun
   tugmaning bosiladigan maydoni manfiy margin bilan kengaytiriladi:
   ko'rinish o'zgarmaydi, tegish maydoni esa qatorning balandligicha. */
.bx.tapbox {
  font: inherit; line-height: 1.5; text-align: left;
  border: 0; background: none; color: var(--link); cursor: pointer;
  padding: .3rem .4rem; margin: -.3rem 0 -.3rem -.4rem;
  border-radius: .4rem; min-width: 2.2rem;
}
.bx.tapbox:hover { background: var(--idle-bg); }
.bx.tapbox:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bx.tapbox:active { transform: scale(.92); }
@media (prefers-reduced-motion: reduce) { .bx.tapbox:active { transform: none; } }

/* «Adashib bosdim» — yopilgan bo'lak QATORIDA. Qator biroz ajratib
   ko'rsatiladi: odam nimani endigina o'zgartirganini ko'rsin. */
.chk.justclosed { background: var(--idle-bg); border-radius: .4rem;
  padding: .32rem .4rem; margin: .1rem -.4rem; }
.undoinline { margin-top: .3rem; font-size: .76rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: .35rem;
  border: 1px solid var(--rule); background: var(--panel);
  color: var(--link); cursor: pointer; white-space: nowrap; }
.undoinline:active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) { .undoinline:active { transform: none; } }
.file.empty { opacity: .75; }
.file.empty .ic { background: var(--idle-bg); color: var(--ink-2); }
.file { margin-top: .5rem; }
.v.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.dateinp { font: inherit; font-size: .82rem; padding: .18rem .35rem;
  border: 1px solid var(--rule); border-radius: .35rem;
  background: var(--panel-2); color: var(--ink); }

/* ---------- «Поддержка» ---------- */
.tabs { display: flex; gap: .25rem; background: var(--panel); border-radius: .6rem;
  padding: .2rem; margin-bottom: .7rem; }
.tab { flex: 1; border: 0; background: none; padding: .4rem; border-radius: .45rem;
  color: var(--ink-2); font-size: .85rem; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--bg); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Muddati o'tgan murojaat — chapdagi qizil chiziq: ro'yxatda bir qarashda ko'rinsin. */
.row.late { box-shadow: inset 3px 0 0 var(--stop); padding-left: .6rem; }
.ttl { font-size: .88rem; overflow-wrap: anywhere; }
.thread { display: flex; flex-direction: column; gap: .45rem; margin-top: .3rem; }
.bub { max-width: 88%; padding: .45rem .6rem; border-radius: .8rem; font-size: .86rem;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.bub .by { display: block; font-size: .7rem; color: var(--ink-2); margin-bottom: .15rem;
  white-space: normal; }
.bub.client { align-self: flex-start; background: var(--panel); border-bottom-left-radius: .25rem; }
.bub.agent { align-self: flex-end; border-bottom-right-radius: .25rem;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.composer { margin-top: 1rem; padding: .6rem; border-radius: .7rem; background: var(--panel);
  display: flex; flex-direction: column; gap: .45rem; }
.composer .tabs { margin: 0; background: var(--idle-bg); }
.composer .tab:disabled { opacity: .45; cursor: not-allowed; }
.composer.is-note { background: var(--risk-bg); }
.reply { width: 100%; font: inherit; font-size: .88rem; padding: .5rem .6rem; resize: vertical;
  border: 1px solid var(--rule); border-radius: .5rem; background: var(--bg); color: var(--ink); }
.sendbtn { border: 0; border-radius: .55rem; padding: .55rem; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--on-accent); }
.composer.is-note .sendbtn { background: var(--risk); color: #fff; }
.sendbtn:disabled { opacity: .6; cursor: progress; }
.acts { display: flex; gap: .4rem; margin-top: .6rem; flex-wrap: wrap; }
.actbtn { flex: 1; border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  border-radius: .55rem; padding: .5rem; font-weight: 600; cursor: pointer; }
.actbtn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.actbtn:disabled { opacity: .6; cursor: progress; }
.chips.quick { margin: 0; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .15rem; }
.sheet-dim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; background: var(--bg);
  border-radius: 1rem 1rem 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: .5rem; max-width: 46rem; margin-inline: auto;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .15); }
.sheet h2 { font-size: 1rem; margin: 0; }
.sheet .sect { margin: .3rem 0 0; }
.check { display: flex; align-items: center; gap: .4rem; font-size: .86rem; }
.sendbtn:disabled { opacity: .5; cursor: not-allowed; }
/* ---------- «Разработка» ---------- */
body.wide { max-width: none; }
.kind { font-size: .68rem; font-weight: 700; padding: .05rem .4rem; border-radius: 1rem;
  margin-right: .15rem; vertical-align: 1px; }
.kind.bug { background: var(--stop-bg); color: var(--stop); }
.kind.idea { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.kind.it { background: var(--idle-bg); color: var(--ink-2); }
.prog { display: flex; gap: 3px; }
.prog > i { flex: 1; height: 4px; border-radius: 2px; background: var(--idle-bg); }
.prog > i.d { background: var(--accent); }
.prog > i.c { background: var(--risk); }
.devadd { margin-top: 1rem; }
.sendbtn { width: 100%; }
.actbtn { width: 100%; margin-top: .4rem; }
.acts .actbtn { width: auto; margin-top: 0; }
.devrow .nm { white-space: nowrap; }
/* Doska: telefonda ustunlar ro'yxati + BITTA ustun; keng oynada hammasi. */
.colnav { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: .3rem; }
.colbtn { flex: none; border: 0; background: none; color: var(--ink-2); font-size: .8rem;
  padding: .3rem .4rem; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.colbtn[aria-pressed="true"] { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.board .col { display: none; }
.board .col.on { display: block; }
.colhead { display: none; }
@media (min-width: 900px) {
  body.wide .colnav { display: none; }
  body.wide .board { display: grid; grid-template-columns: repeat(7, minmax(10rem, 1fr)); gap: .6rem;
    overflow-x: auto; }
  body.wide .board .col { display: block; background: var(--panel); border-radius: .6rem; padding: .4rem .6rem; }
  body.wide .colhead { display: block; font-weight: 700; font-size: .82rem; padding: .2rem 0 .3rem; }
  body.wide .board.svcboard { grid-template-columns: repeat(5, minmax(12rem, 1fr)); }
}
.steps { display: flex; flex-direction: column; gap: .3rem; }
.step { display: flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--ink-2); }
.step > i { width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--rule); flex: none; }
.step.done > i { background: var(--accent); border-color: var(--accent); }
.step.done { color: var(--ink); }
.step.now span { font-weight: 700; }
.desc { white-space: pre-wrap; font-size: .86rem; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.tile { display: flex; flex-direction: column; gap: .15rem; text-align: left; padding: .6rem;
  border: 1.5px solid var(--rule); border-radius: .6rem; background: var(--bg); cursor: pointer; }
.tile span { font-size: .74rem; color: var(--ink-2); }
.tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.fld { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .7rem; }
.fld label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.fld label em { color: var(--stop); font-style: normal; }
.fld label small { font-weight: 400; }
.fld .chips { margin: 0; }
.reply.err { border-color: var(--stop); background: var(--stop-bg); }
.errt { font-size: .74rem; color: var(--stop); }
select.reply { appearance: auto; }
/* ---------- fayllar ---------- */
.files { display: flex; flex-direction: column; gap: .3rem; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  font-size: .82rem; padding: .3rem .5rem; background: var(--panel); border-radius: .4rem;
  overflow-wrap: anywhere; }
.fx { border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: .9rem; flex: none; }
.gallery { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; margin-top: .3rem; }
.thumb { width: 5.5rem; height: 5.5rem; object-fit: cover; border-radius: .45rem;
  background: var(--idle-bg); cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .85);
  display: grid; place-items: center; padding: 1rem; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: .3rem; }
.ufile { display: none; }
/* Ichki eslatma — sariq va chiziqli: mijoz xabari bilan adashtirilmasin. */
.bub.note { align-self: stretch; max-width: 100%; background: var(--risk-bg);
  border: 1px dashed var(--risk); border-radius: .5rem; }
