/* Onest — SIL Open Font License 1.1 (Google Fonts), o'z serverimizdan beriladi */
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/onest-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/onest-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/onest-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f4f7);
  --text: var(--tg-theme-text-color, #101828);
  --hint: var(--tg-theme-hint-color, #8a919c);
  --link: var(--tg-theme-link-color, #2f6fed);
  --btn: var(--tg-theme-button-color, #2f6fed);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-section-bg-color, var(--bg));
  --sep: color-mix(in srgb, var(--hint) 20%, transparent);
  --soft: color-mix(in srgb, var(--btn) 9%, var(--bg));
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;
  --violet: #7c3aed;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 10px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg2);
  color: var(--text);
  font: 15px/1.45 "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 104px;
  min-height: 100vh;
}
button, input, textarea, select { font-family: inherit; }
button { font-size: inherit; cursor: pointer; color: inherit; }
.hidden { display: none !important; }
.i { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- sarlavha ---------- */
header { background: var(--bg); padding: 16px 16px 12px; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: color-mix(in srgb, var(--btn) 14%, var(--bg)); color: var(--btn);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .2px;
}
.name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.role { color: var(--hint); font-size: 13px; }

/* ---------- tablar ---------- */
nav#tabs {
  display: flex; gap: 4px; overflow-x: auto;
  background: var(--bg); padding: 2px 12px 0;
  position: sticky; top: 0; z-index: 5;
  box-shadow: inset 0 -1px 0 var(--sep);
  scrollbar-width: none;
}
nav#tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--hint);
  padding: 10px 10px 12px; font-size: 14.5px; font-weight: 600; position: relative;
}
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2.5px; border-radius: 2px; background: var(--btn); }
.tab .badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
}

/* ---------- filtrlar ---------- */
#toolbar { padding: 12px 12px 0; display: flex; gap: 8px; }
#toolbar:empty { display: none; }
.filter {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--sep); border-radius: 12px; padding: 8px 10px; background: var(--card);
  text-align: left; font-size: 14px; font-weight: 600;
}
.filter .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fic { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg2); color: var(--hint); }
.fic .i { width: 16px; height: 16px; }
.fic.blue { color: var(--btn); background: var(--soft); }
.chev { width: 18px; height: 18px; color: var(--hint); }

/* ---------- formalar ---------- */
select, input, textarea {
  font-size: 15px; color: var(--text); background: var(--bg2);
  border: 1.5px solid transparent; border-radius: 12px; padding: 12px 14px; width: 100%;
  outline: none; transition: border-color .15s, background .15s;
}
select:focus, input:focus, textarea:focus { border-color: var(--btn); background: var(--bg); }
input::placeholder, textarea::placeholder { color: var(--hint); }
textarea { resize: vertical; min-height: 96px; }
.field { margin-bottom: 14px; }
.field label, .field .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--hint); margin: 0 2px 6px; }
.pickbtn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1.5px solid transparent; border-radius: 12px; padding: 10px 12px; background: var(--bg2); min-height: 52px;
}
.pickbtn:disabled { cursor: default; }
.pickbtn .ic { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--bg); color: var(--hint); }
.pickbtn .tx { flex: 1; min-width: 0; }
.pickbtn .main { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickbtn .sub { font-size: 12.5px; color: var(--hint); }

/* ---------- ro'yxat ---------- */
main { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.section-title { color: var(--hint); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; margin: 6px 4px 0; }
.empty { text-align: center; color: var(--hint); padding: 56px 24px; line-height: 1.55; }
.empty-ic {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center;
  background: var(--card); color: var(--hint); box-shadow: var(--shadow);
}
.empty-ic .i { width: 26px; height: 26px; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 14px 15px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card.running::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-title { font-weight: 650; font-size: 16px; letter-spacing: -.01em; word-break: break-word; }
.card-desc {
  color: var(--hint); font-size: 14px; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--hint); }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }
.meta .i { width: 15px; height: 15px; }
.meta b { color: var(--text); font-weight: 600; }
.meta .tag { color: var(--orange); font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }

.pill { flex: 0 0 auto; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.s-new { background: color-mix(in srgb, var(--btn) 12%, transparent); color: var(--btn); }
.s-in_progress { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); }
.s-paused { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange); }
.s-submitted { background: color-mix(in srgb, var(--violet) 12%, transparent); color: var(--violet); }
.s-returned { background: color-mix(in srgb, var(--red) 11%, transparent); color: var(--red); }
.s-approved { background: color-mix(in srgb, var(--hint) 15%, transparent); color: var(--hint); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--hint); }
.d-new { background: var(--btn); }
.d-in_progress { background: var(--green); }
.d-paused { background: var(--orange); }
.d-submitted { background: var(--violet); }
.d-returned { background: var(--red); }
.d-approved { background: var(--hint); }

.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 28px; letter-spacing: -.01em; margin-top: 10px; }
.timer.on { color: var(--green); }
.actions { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 12px; padding: 12px; font-weight: 600; font-size: 15px;
  background: var(--btn); color: var(--btn-text); white-space: nowrap; transition: transform .08s, opacity .15s;
}
.btn .i { width: 17px; height: 17px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--bg2); color: var(--text); }
.btn.green { background: var(--green); color: #fff; }
.btn.red { background: color-mix(in srgb, var(--red) 10%, var(--bg)); color: var(--red); }

.note {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; padding: 10px 12px;
  border-radius: 12px; background: var(--bg2); font-size: 14px; word-break: break-word;
}
.note .i { width: 16px; height: 16px; margin-top: 2px; color: var(--hint); }
.note.warn { background: color-mix(in srgb, var(--red) 7%, var(--bg)); }
.note.warn .i { color: var(--red); }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.kv { background: var(--bg2); border-radius: 12px; padding: 9px 11px; }
.kv .k { color: var(--hint); font-size: 12.5px; }
.kv .v { font-weight: 600; font-size: 15px; margin-top: 2px; }

.fab {
  position: fixed; right: 18px; bottom: 24px; z-index: 10;
  width: 56px; height: 56px; border-radius: 18px; border: 0; display: grid; place-items: center;
  background: var(--btn); color: var(--btn-text);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--btn) 35%, transparent);
}
.fab .i { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:active { transform: scale(.95); }

/* ---------- pastki oyna ---------- */
.sheet, .layer { position: fixed; inset: 0; z-index: 20; }
.layer { z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, .45); animation: fade .2s; }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  animation: up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--sep); margin: 4px auto 14px; }
.sheet h2 { margin: 0 0 16px; font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.desc-full { white-space: pre-wrap; margin: 0 0 14px; word-break: break-word; }

.logs { display: flex; flex-direction: column; }
.log { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--sep); font-size: 14px; }
.log:last-child { border-bottom: 0; }
.log .n { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px; background: var(--bg2); color: var(--hint); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.log .grow { flex: 1; min-width: 0; }
.log .dur { float: right; color: var(--hint); font-weight: 600; }
.log .on { color: var(--green); }
.log .why { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; color: var(--hint); font-size: 13px; }
.log .why .i { width: 14px; height: 14px; margin-top: 2px; color: var(--orange); }

/* ---------- tanlash ro'yxati ---------- */
.opts { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 12px; padding: 9px 10px;
}
.opt:active, .opt.sel { background: var(--soft); }
.opt .avatar { width: 40px; height: 40px; font-size: 14px; }
.opt .ic { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--bg2); color: var(--hint); }
.opt .ic.blue { background: var(--soft); color: var(--btn); }
.opt .ic.red { color: var(--red); }
.opt .tx { flex: 1; min-width: 0; }
.opt .main { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt .sub { font-size: 13px; color: var(--hint); }
.opt .cnt { font-size: 12.5px; font-weight: 600; color: var(--hint); min-width: 24px; text-align: right; }
.opt .check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: transparent; }
.opt .check .i { width: 14px; height: 14px; stroke-width: 3; }
.opt.sel .check { background: var(--btn); color: var(--btn-text); }
.search { position: relative; margin-bottom: 10px; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--hint); }
.search input { padding-left: 38px; }

.hint { display: flex; align-items: center; gap: 8px; margin: -2px 2px 14px; color: var(--hint); font-size: 13.5px; }
.hint .i { width: 16px; height: 16px; color: var(--green); }

/* ---------- kalendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head .ttl { font-weight: 700; font-size: 17px; text-transform: capitalize; }
.cal-nav { width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--bg2); display: grid; place-items: center; }
.cal-nav:disabled { opacity: .35; }
.rot90 { transform: rotate(90deg); }
.rot-90 { transform: rotate(-90deg); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-wd { font-size: 12px; font-weight: 600; color: var(--hint); padding: 6px 0; }
.cal-wd.we { color: color-mix(in srgb, var(--red) 65%, var(--hint)); }
.cal-d {
  aspect-ratio: 1; max-height: 44px; border: 0; background: transparent; border-radius: 12px;
  font-weight: 500; font-size: 15px; display: grid; place-items: center; position: relative;
}
.cal-d.out { color: var(--hint); opacity: .5; }
.cal-d.today { color: var(--btn); font-weight: 700; }
.cal-d.today::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.cal-d.sel { background: var(--btn); color: var(--btn-text); font-weight: 700; }
.cal-d:disabled { opacity: .25; }
.cal-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg2); border-radius: 14px; padding: 8px 12px 8px 14px; margin: 12px 0 4px;
}
.cal-summary .d { font-weight: 700; }
.cal-summary .d small { display: block; font-weight: 500; color: var(--hint); font-size: 12.5px; }
.wheels { display: flex; align-items: center; gap: 4px; }
.wheel-box { position: relative; }
.wheel-box::before {
  content: ""; position: absolute; left: 0; right: 0; top: 44px; height: 44px; border-radius: 10px;
  background: var(--bg); pointer-events: none;
}
.wheel {
  position: relative; height: 132px; width: 56px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none;
  mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel div { height: 44px; display: grid; place-items: center; scroll-snap-align: center; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wheel .pad { scroll-snap-align: none; }
.wheels .colon { font-size: 21px; font-weight: 600; }

/* ---------- jamoa ---------- */
.user-row { display: flex; align-items: center; gap: 12px; }
.user-row .grow { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.stat { background: var(--bg2); border-radius: 12px; padding: 8px 4px; text-align: center; }
.stat .n { font-weight: 700; font-size: 18px; }
.stat .l { font-size: 11.5px; color: var(--hint); }
.stat.green .n { color: var(--green); }
.icon-btn { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--bg2); color: var(--hint); display: grid; place-items: center; }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 60;
  background: rgba(16, 24, 40, .94); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  max-width: 88vw; text-align: center; animation: fade .2s;
}

@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
