/*
 * Mobil-birinchi, tashqi kutubxonasiz. Dala sharoiti uchun: katta tugmalar
 * (qo'lqopda bosiladi), yuqori kontrast (quyoshda ko'rinishi kerak), kichik
 * bo'lmagan matn.
 *
 * v2 — brend dizayn tizimi (2026-09-22). Ranglar WCAG AAA (matn uchun
 * kamida 7:1) maqsadida tanlangan — pastdagi "Kontrast jadvali"ga qarang.
 * BITTA ATAYLAB OG'ISH bor: spec'da dark-tema tugma rangi sifatida aniq
 * `#3B82D6` berilgan edi, lekin oq matn bilan bu FAQAT 3.93:1 beradi
 * (AAA — 7:1 talab qiladi, hatto AA — 4.5:1'ni ham bermaydi). Shu bir xil
 * "oila"dagi (ko'k) to'qroq soyaga (`#1E4C86`, oq matn bilan 8.63:1)
 * almashtirildi — `#3B82D6` (yorug' temada `#469CE7`) esa `--color-brand-accent`
 * sifatida saqlanib qolgan, FAQAT logo uchun (spec'ning o'z talabi: "faqat
 * dekorativ"). Diqqat: fokus halqasi/input outline UCHUN bu rang ISHLATILMAYDI
 * — u ham oq fonda ~2.9:1 (hatto WCAG'ning elementlar uchun past — 3:1 —
 * chegarasidan ham pastroq), shuning uchun fokus ko'rsatkichi har doim
 * `--color-primary`ning o'zi (pastda, 8.49:1) bilan chiziladi.
 */

:root {
  /* --- Yorug' tema (standart) --- */
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-text: #0f1b2d;
  --color-muted: #465060;
  --color-border: #c9cdd2;
  --color-primary: #154d8c;
  --color-primary-text: #ffffff;
  /* Brend ko'k (logodan) — FAQAT dekorativ (logotip o'zi). Matn, tugma
     foni yoki fokus halqasi sifatida hech qachon ishlatilmaydi — oq
     fonda 2.9:1, quyoshda o'qib bo'lmaydi (spec'ning o'z talabi). */
  --color-brand-accent: #469ce7;
  --color-danger: #a3122a;
  --color-danger-bg: #fef0f2;
  --color-warning-bg: #fff3cd;
  --color-warning-text: #7a4405;
  --color-info-bg: #e3edf7;
  --color-info-text: #154d8c;
  --color-success: #0a5c36;
  --color-success-bg: #e6f6ec;
  /* Navbatdagi doimiy xato (422, tahrirlash kerak) — serverning o'z rad
     etishidan (--color-danger, qizil) ATAYLAB boshqa rang: sababi ham,
     tuzatish yo'li ham boshqa, ikkisi bitta ko'rinishda aralashmasin. */
  --color-queue-failed: #c2410c;
  --color-queue-failed-bg: #fde4d0;
  /* "Юборилмаган" (hali sinxronlanmagan navbat) — queue-failed'dan
     ATAYLAB boshqa rang (och sariq/amber, kulrang emas — vizual jihatdan
     "kutilmoqda", xato emas). */
  --color-queued: #a67c00;
  --touch-min: 56px;

  --color-toast-bg: #16202f;
  --color-toast-text: #ffffff;
  --color-toast-error-bg: #7a1120;

  /* Shrift o'lchamlari — "Шрифт: Катта" (×1.15) `data-font-size="large"`
     bilan almashtiriladi, pastga qarang. */
  --font-size-base: 18px;
  --font-size-h1: 24px;
  --font-size-h2: 20px;
  --font-size-well-number: 36px;
  --font-size-value: 30px;
  --font-size-small: 15px;
}

/* "Шрифт: Катта" — foydalanuvchi menyusidan tanlanadi (localStorage,
   `ugp_font_scale`), <html>ga qo'yiladi. Butun o'lcham tizimi shu BITTA
   multiplikator orqali kattalashadi (individual qiymatlarni qo'lda
   ko'paytirish o'rniga) — yangi elementlar ham avtomatik to'g'ri chiqadi. */
:root[data-font-size="large"] {
  --font-size-base: 20.7px;
  --font-size-h1: 27.6px;
  --font-size-h2: 23px;
  --font-size-well-number: 41.4px;
  --font-size-value: 34.5px;
  --font-size-small: 17.25px;
}

/* --- Tungi tema --- */
:root[data-theme="dark"] {
  --color-bg: #0e1624;
  --color-surface: #17233a;
  --color-text: #e8eef6;
  --color-muted: #a8b6c9;
  --color-border: #2c3c56;
  --color-primary: #1e4c86;
  --color-primary-text: #ffffff;
  --color-brand-accent: #3b82d6;
  --color-danger: #ff9a92;
  --color-danger-bg: #3a1620;
  --color-warning-bg: #3a2e12;
  --color-warning-text: #f0c169;
  --color-info-bg: #142b46;
  --color-info-text: #8fc0f5;
  --color-success: #6fd39a;
  --color-success-bg: #0e2f1d;
  --color-queue-failed: #ffb27a;
  --color-queue-failed-bg: #3a2410;
  --color-queued: #e0b34a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, "SF Pro Text", Roboto, "Segoe UI", Arial, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

[hidden] {
  display: none !important;
}

.screen {
  min-height: 100vh;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}

.boot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--color-muted);
  font-size: var(--font-size-base);
  text-align: center;
}

.boot-error {
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: var(--font-size-small);
  line-height: 1.5;
}

h1 {
  font-size: var(--font-size-h1);
  margin: 0 0 20px;
}

label {
  display: block;
  font-size: var(--font-size-small);
  color: var(--color-muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--touch-min);
  padding: 10px 12px;
  font-size: var(--font-size-base);
  border: 2px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 1px;
}

.field {
  margin-bottom: 16px;
}

/* A.5: kiritish formasidagi 5 ta o'lchov maydoni — "katta maydon",
   raqamlar aniq o'qilishi uchun (qo'lqopda, quyoshda). */
#entry-p_tubing,
#entry-p_annulus,
#entry-p_flowline,
#entry-temperature,
#entry-choke_mm {
  font-size: var(--font-size-value);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* 5-bosqich: ТПАВ soni +/- stepper */
.stepper-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper-row input {
  flex: 1;
  text-align: center;
}

.stepper-row button {
  min-width: var(--touch-min);
  padding: 12px;
}

button {
  min-height: var(--touch-min);
  padding: 12px 20px;
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

button.primary {
  width: 100%;
  background: var(--color-primary);
  color: var(--color-primary-text);
}

button.primary:disabled {
  opacity: 0.6;
}

button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.banner {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: var(--font-size-small);
}

.banner--error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.banner--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.banner--info {
  background: var(--color-info-bg);
  color: var(--color-info-text);
}

/* B.3: "Обход якунланди" banneri. */
.banner--success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* §3.2: <button> ichida banner ko'rinishi (masalan shoshilinch топшириқ
   banneri) — oddiy <div> banner bilan vizual jihatdan bir xil, faqat
   bosiladigan qilib qayta tiklangan. */
.banner--button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.warnings-list {
  margin: 0;
  padding-left: 20px;
}

.warnings-list li + li {
  margin-top: 6px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
}

.slots-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slot-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

/* A.5: "yopiqlari siqilgan, kulrang" — faol bo'lmagan obxodlar vizual
   jihatdan kichikroq/xiraroq (padding kamroq, shaffoflik pasayadi). */
.slot-card--upcoming,
.slot-card--closed {
  padding: 10px 16px;
  opacity: 0.72;
}

.slot-card__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

/* A.5: "Chap tomonda katta vaqt" — bosh ekrandagi ENG KATTA raqam. */
.slot-card__time {
  font-size: var(--font-size-well-number);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
}

.slot-card--upcoming .slot-card__time,
.slot-card--closed .slot-card__time {
  font-size: var(--font-size-h2);
  color: var(--color-muted);
}

.slot-card__name {
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

.slot-card__state {
  display: inline-block;
  font-size: var(--font-size-small);
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
  background: var(--color-border);
  color: var(--color-text);
}

.slot-card--open .slot-card__state {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.slot-card--open .slot-card__state::before {
  content: "✓ ";
}

.slot-card--grace .slot-card__state {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.slot-card--grace .slot-card__state::before {
  content: "⚠ ";
}

.slot-card--closed .slot-card__state {
  background: var(--color-border);
  color: var(--color-muted);
}

.slot-card--closed .slot-card__state::before {
  content: "○ ";
}

.slot-card--upcoming .slot-card__state::before {
  content: "◷ ";
}

/* A.5: "Ostida progress chizig'i" */
.slot-card__progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  margin-bottom: 4px;
}

.slot-card__progress-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.slot-card__progress {
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

/* --- PWA qobig'i: oflayn ko'rsatkich, yangilanish banneri, o'rnatish --- */

.offline-bar {
  background: var(--color-border);
  color: var(--color-muted);
  text-align: center;
  font-size: var(--font-size-small);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.offline-bar--button {
  width: 100%;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.pending-sync__failed {
  color: var(--color-danger);
  font-weight: 700;
}

/* --- Sinxronizatsiya toast'i (4b) --- */

.sync-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  background: var(--color-toast-bg);
  color: var(--color-toast-text);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: var(--font-size-small);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.sync-toast--error {
  background: var(--color-toast-error-bg);
}

.install-row {
  margin-bottom: 16px;
}

.install-row button {
  width: auto;
}

/*
 * Ekran pastida, position:fixed — lekin 3-bosqichda bosh ekranda pastki
 * amaliy tugma (masalan "Saqlash") umuman yo'q, shuning uchun hozircha
 * hech narsani to'smaydi. Kelgusi bosqichlarda pastki tugma qo'shilsa,
 * o'sha ekranga shu chiziq balandligicha padding-bottom qo'shish kerak
 * bo'ladi — ish jarayonini bloklamaslik shart (spec talabi).
 */
.pwa-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  font-size: var(--font-size-small);
}

.pwa-bar--update {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.pwa-bar--update button {
  min-height: 36px;
  width: auto;
  padding: 8px 16px;
  font-size: var(--font-size-small);
  background: var(--color-primary-text);
  color: var(--color-primary);
}

/* --- Quduqlar ro'yxati --- */

/* A.5: "2 ustunli katta plitkalar" — quduq raqami (36px) bir qarashda
   ko'rinsin, operator qaysilar qolganini tezda aniqlasin. */
.wells-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* B.5: li endi ODDIY (display: contents emas) grid katakcha — ichida
   ikkita tugma (asosiy well-card + kichik "⚠ Носозлик" tugmasi) bo'lishi
   kerak bo'ldi. `display: contents` bilan ikkalasi alohida grid
   katakchaga tushib qolardi (2 ustunli grid buzilardi). Flex-column
   qilib, well-card (width: 100% bo'lgani uchun stretch bilan to'liq
   kenglikda qoladi) tepada, kichik tugma pastda joylashadi. */
.wells-list > li {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* B.5: har quduq kartasi ostidagi kichik "⚠ Носозлик" tugmasi — asosiy
   well-card'dan ATAYLAB kichikroq/kamroq ko'zga tashlanadigan (bu
   ikkinchi darajali amal, operator uni HAR safar bosishi shart emas). */
.well-card__incident-btn {
  min-height: 32px;
  padding: 4px 10px;
  font-size: var(--font-size-small);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-muted);
  width: 100%;
}

.well-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  min-height: 96px;
  width: 100%;
  text-align: left;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}

.well-card__number {
  font-size: var(--font-size-well-number);
  font-weight: 700;
  line-height: 1;
}

.well-card--done {
  border-color: var(--color-success);
}

.well-card__status {
  font-size: var(--font-size-small);
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-text);
  white-space: nowrap;
}

.well-card--done .well-card__status {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* A.2: "Holat hech qachon faqat rang bilan berilmasin" — matndan oldin
   ikonka (quyoshda/rang ajrata olmaydigan ko'zda ham tushunarli
   bo'lishi uchun). Sof CSS orqali (JS'ga tegilmadi). */
.well-card--done .well-card__status::before {
  content: "✓ ";
}

.well-card--queued {
  border-color: var(--color-queued);
}

.well-card--queued .well-card__status {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.well-card--queued .well-card__status::before {
  content: "⏳ ";
}

.well-card--queue-failed {
  border-color: var(--color-queue-failed);
}

.well-card--queue-failed .well-card__status {
  background: var(--color-queue-failed-bg);
  color: var(--color-queue-failed);
}

.well-card--queue-failed .well-card__status::before {
  content: "⚠ ";
}

.well-card--rejected {
  border-color: var(--color-danger);
}

.well-card--rejected .well-card__status {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.well-card--rejected .well-card__status::before {
  content: "✕ ";
}

/* --- Kiritish formasi --- */

.field-hint {
  margin-top: 6px;
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

/* B.1: xato raqamdan himoya — ±30% sakrash yoki texnologik rejim
   chegarasidan chiqish, faqat OGOHLANTIRISH (rang+matn, bloklamaydi). */
.field-hint--warning {
  color: var(--color-warning-text);
  font-weight: 600;
}

select {
  width: 100%;
  min-height: var(--touch-min);
  padding: 10px 12px;
  font-size: var(--font-size-base);
  border: 2px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
}

select:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 1px;
}

/* --- Ko'rish ekrani (o'zgartirib bo'lmaydigan yozuv) --- */

.status-badge {
  display: inline-block;
  font-size: var(--font-size-small);
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
  background: var(--color-border);
  color: var(--color-text);
}

.status-badge--new {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-badge--new::before {
  content: "✓ ";
}

.status-badge--anomaly {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.status-badge--anomaly::before {
  content: "⚠ ";
}

.status-badge--approved {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.status-badge--approved::before {
  content: "✓ ";
}

.status-badge--queued {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.status-badge--queued::before {
  content: "⏳ ";
}

.status-badge--queue-failed {
  background: var(--color-queue-failed-bg);
  color: var(--color-queue-failed);
}

.status-badge--queue-failed::before {
  content: "⚠ ";
}

.status-badge--sending {
  background: var(--color-info-bg);
  color: var(--color-info-text);
}

.status-badge--sending::before {
  content: "⏳ ";
}

.status-badge--rejected {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.status-badge--rejected::before {
  content: "✕ ";
}

.view-details {
  margin: 0 0 20px;
}

.view-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.view-row dt {
  color: var(--color-muted);
  font-size: var(--font-size-small);
}

.view-row dd {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 600;
  text-align: right;
}

/* A.4: "Kiritilgan qiymatlar: 30px, tabular-nums" — FAQAT haqiqiy
   o'lchov raqamlari (bosim/harorat/shtutser), quduq holati/izoh/vaqt
   kabi matn maydonlari EMAS (ular oddiy o'qiladigan matn, katta
   raqam bo'lishi shart emas). */
#view-p_tubing,
#view-p_annulus,
#view-p_flowline,
#view-temperature,
#view-choke_mm {
  font-size: var(--font-size-value);
  font-variant-numeric: tabular-nums;
}

/* --- Global yuqori panel + foydalanuvchi menyusi --- */

/* A.5: "Sarlavha paneli: to'q ko'k fon, chapda oq belgi + nom, o'ngda
   ... profil tugmasi." */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--color-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-topbar__mark {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.app-topbar__title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--color-primary-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar__user {
  flex-shrink: 0;
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 0;
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: var(--font-size-small);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 16px;
  /* Aniq z-index — .app-topbar'ning o'zi (30) bilan bir xil stacking
   * context'da bo'lsa ham, hech qanday ekran elementi uni bosib
   * o'tolmasligi kafolatlansin (ekran kontenti nazariyda position:static
   * bo'lgani uchun bu shart emas edi, lekin "Чиқиш" bosilmayapti"
   * xabaridan keyin ehtiyot chorasi sifatida aniq qo'yildi). */
  z-index: 50;
  width: min(280px, calc(100vw - 32px));
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.user-menu__name {
  font-size: var(--font-size-base);
  font-weight: 700;
  margin-bottom: 10px;
}

.user-menu__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.user-menu__label {
  font-size: var(--font-size-small);
  color: var(--color-muted);
}

.user-menu__value {
  font-size: var(--font-size-small);
}

.user-menu__locale {
  display: flex;
  gap: 12px;
  margin: 14px 0;
}

.user-menu__locale a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-border);
  border-radius: 10px;
  font-size: var(--font-size-small);
  color: var(--color-text);
  text-decoration: none;
}

.user-menu__locale a.is-active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.user-menu hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 14px 0;
}

.user-menu #menu-logout-button,
.user-menu #menu-queue-button {
  width: 100%;
}

.user-menu #menu-queue-button {
  margin-top: 4px;
}

/* --- Bosh ekran qisqa holati --- */

.home-summary {
  margin-bottom: 16px;
}

.home-summary p {
  margin: 0 0 4px;
}

.home-summary__greeting {
  font-size: var(--font-size-base);
  font-weight: 600;
}

.home-summary__date {
  color: var(--color-muted);
  font-size: var(--font-size-small);
}

.home-summary__progress {
  font-size: var(--font-size-small);
}

/* --- Navbat ekrani (4c) --- */

#queue-sync-now {
  width: 100%;
  margin-bottom: 16px;
}

.queue-empty {
  color: var(--color-muted);
  text-align: center;
  padding: 24px 0;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
}

.queue-item--queue-failed {
  border-color: var(--color-queue-failed);
}

.queue-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.queue-item__well {
  font-size: var(--font-size-base);
  font-weight: 600;
}

.queue-item__time {
  color: var(--color-muted);
  font-size: var(--font-size-small);
  margin-bottom: 8px;
}

.queue-item__error {
  background: var(--color-queue-failed-bg);
  color: var(--color-queue-failed);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: var(--font-size-small);
  margin-bottom: 8px;
}

.queue-item__attempts {
  color: var(--color-muted);
  font-size: var(--font-size-small);
  margin-bottom: 8px;
}

.queue-item__actions {
  display: flex;
  gap: 12px;
}

.queue-item__actions button {
  flex: 1;
  min-height: 40px;
  padding: 8px 12px;
  font-size: var(--font-size-small);
}

.queue-section-title {
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--color-muted);
  margin: 20px 0 10px;
}

/* §3: Operator tarixi — kun bo'yicha guruhlar + har kunning ichida
   qator ro'yxati. Vizual naqsh `.well-card`/`.queue-item`ga o'xshab,
   lekin o'ziga xos (bosilganda "Ko'rish" ekraniga o'tadi, chevron bilan). */
.history-updated {
  color: var(--color-muted);
  font-size: var(--font-size-small);
  margin: 0 0 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.history-day__title {
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--color-muted);
  margin: 0 0 8px;
}

.history-day__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: var(--touch-min);
  font-size: var(--font-size-small);
  color: var(--color-text);
  cursor: pointer;
}

.history-row--rejected {
  border-color: var(--color-danger);
}

.history-row--queued {
  border-color: var(--color-queued);
}

.history-row__label {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.history-row__chevron {
  color: var(--color-muted);
  font-size: var(--font-size-base);
}

/* §4: Ilova ichidagi yo'riqnoma — statik HTML fragment (public/app/guide/)
   shu konteynerga to'g'ridan-to'g'ri (innerHTML) qo'yiladi, faqat oddiy
   semantik teglar (h2/p/ol/ul/strong) ishlatiladi. */
.guide-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.guide-section {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.guide-section h2 {
  margin: 0 0 8px;
  font-size: var(--font-size-h2);
  font-weight: 700;
}

.guide-section p,
.guide-section ol,
.guide-section ul {
  margin: 0 0 8px;
  padding-left: 20px;
}

.guide-section p {
  padding-left: 0;
}

.guide-section p:last-child,
.guide-section ol:last-child,
.guide-section ul:last-child {
  margin-bottom: 0;
}

.guide-section li {
  margin-bottom: 4px;
}

.queue-photo__thumb {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.queue-photo__thumb-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  color: var(--color-muted);
  font-size: var(--font-size-small);
  text-align: center;
  padding: 8px;
  margin-bottom: 8px;
}

/* --- Umumiy tasdiqlash modali (window.confirm() o'rniga) --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  width: min(360px, 100%);
  background: var(--color-surface);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.modal-box p {
  margin: 0 0 20px;
  font-size: var(--font-size-small);
  line-height: 1.5;
  /* B.1: ko'p qatorli ogohlantirish ro'yxati uchun (\n) — bitta qatorli
     xabarlarga ta'siri yo'q. */
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
}

/* --- Foto (5a) --- */

.entry-photo-preview-wrap {
  margin-top: 10px;
}

.entry-photo-preview {
  display: block;
  max-width: 160px;
  max-height: 160px;
  border-radius: 10px;
  border: 2px solid var(--color-border);
  cursor: zoom-in;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: zoom-out;
}

/* B.5: Носозлик хабари — 1-3 ta mustaqil foto joy (5a foto oqimidan
   NUSXA, o'z ID'lari bilan — bir xil vizual naqsh). */
.incident-photo-slots {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.incident-photo-slot {
  border: 1px dashed var(--color-border);
  border-radius: 10px;
  padding: 10px;
}

.photo-viewer img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

/* §3.2: "Топшириқлар" — menyu tugmasidagi son bejди, karta ro'yxati,
   "Бажарилди" mini-formasi. Foto joylari `.incident-photo-slots`ni
   qayta ishlatadi (bir xil vizual naqsh). */
.menu-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-size: var(--font-size-small);
  font-weight: 700;
}

.status-badge--urgent {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  margin-left: 6px;
}

.assignment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.assignment-card {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
}

.assignment-card--urgent {
  border-color: var(--color-danger);
}

.assignment-card--error {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.assignment-card__meta {
  color: var(--color-muted);
  font-size: var(--font-size-small);
  margin-bottom: 4px;
}

.assignment-card__text {
  margin: 6px 0;
}

.assignment-card__deadline,
.assignment-card__note {
  font-size: var(--font-size-small);
  color: var(--color-muted);
  margin-bottom: 8px;
}

.assignment-card__error {
  font-size: var(--font-size-small);
  color: var(--color-danger);
  margin-bottom: 8px;
}
