/* =============================================================================
   E18 NIZO · E19 AI TAHLIL · E20 VIOLATION (V1–V4) · E21 1001 YORDAM — uslublar.
   task-45 (TASK-002, 8-infografika).

   - akcent #FFD21F · radius 12–18px · bosish maydoni >= 48px;
   - kontrast AA (>= 4.5:1) · V darajalar rangli (V1 sariq … V4 to'q qizil);
   - tungi rejim 3 yo'l · prefers-reduced-motion · telefon/planshet;
   - `home.css` va boshqa fayllar TEGILMAYDI (faqat .mbxd-* prefiksi).
   ========================================================================== */

.mbxd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 78;
  background: rgb(12 15 20 / 45%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: mbxd-fade 160ms ease-out;
}

.mbxd-backdrop[hidden] { display: none !important; }

@keyframes mbxd-fade { from { opacity: 0; } to { opacity: 1; } }

.mbxd {
  --mbxd-bg: #ffffff;
  --mbxd-soft: #f7f8fa;
  --mbxd-ink: #17181c;
  --mbxd-muted: #5e646e;
  --mbxd-line: #e6e9ee;
  --mbxd-accent: #ffd21f;
  --mbxd-on-accent: #17181c;
  --mbxd-danger: #c62828;
  --mbxd-danger-deep: #7f1d1d;
  --mbxd-warn: #b45309;
  --mbxd-success: #1f7a32;
  --mbxd-info: #1b4fa8;
  --mbxd-target: 48px;

  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 93vh;
  overflow-y: auto;
  padding: 12px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  background: var(--mbxd-bg);
  color: var(--mbxd-ink);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 18px 55px rgb(16 20 24 / 16%);
  font: 500 15px/1.45 var(--mbx-font-body, Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  box-sizing: border-box;
  animation: mbxd-up 180ms cubic-bezier(.2, .8, .2, 1);
  -webkit-overflow-scrolling: touch;
}

.mbxd *, .mbxd *::before, .mbxd *::after { box-sizing: border-box; }

@keyframes mbxd-up { from { transform: translateY(14px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

/* --------------------------------------------------------------- sarlavha */

.mbxd-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.mbxd-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--mbxd-ink);
}

.mbxd-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--mbxd-muted);
  line-height: 1.45;
}

.mbxd-body { display: grid; gap: 12px; }

.mbxd-view { display: grid; gap: 12px; }

.mbxd-section {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--mbxd-muted);
  text-transform: none;
  letter-spacing: 0;
}

.mbxd-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--mbxd-muted);
}

.mbxd-order {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 10px 12px;
  background: var(--mbxd-soft);
  border-radius: 12px;
  font-size: 14px;
}

.mbxd-order-label { color: var(--mbxd-muted); font-weight: 600; }
.mbxd-order-id { font-weight: 800; letter-spacing: -.2px; }

.mbxd-deadline { font-weight: 600; }
.mbxd-hold { font-weight: 700; color: var(--mbxd-ink); }
.mbxd-sla { font-weight: 700; color: var(--mbxd-ink); }
.mbxd-transparency { font-weight: 600; color: var(--mbxd-ink); }

/* -------------------------------------------------------------- tugmalar */

.mbxd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--mbxd-target);
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--mbxd-soft);
  color: var(--mbxd-ink);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, filter .12s ease;
}

.mbxd-btn:hover { filter: brightness(.97); }
.mbxd-btn:active { transform: scale(.995); }

.mbxd-primary {
  background: var(--mbxd-accent);
  color: var(--mbxd-on-accent);
  font-weight: 800;
  letter-spacing: -.2px;
}

.mbxd-primary[disabled], .mbxd-btn[disabled] { opacity: .55; cursor: default; }

.mbxd-ghost {
  background: var(--mbxd-soft);
  border: 1px solid var(--mbxd-line);
  font-weight: 700;
}

.mbxd-danger {
  background: var(--mbxd-danger);
  color: #ffffff;
  font-weight: 800;
}

.mbxd-icon-btn {
  display: grid;
  place-items: center;
  width: var(--mbxd-target);
  height: var(--mbxd-target);
  min-width: var(--mbxd-target);
  border: 0;
  border-radius: 50%;
  background: var(--mbxd-soft);
  color: var(--mbxd-ink);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.mbxd-remove { color: var(--mbxd-danger); }

.mbxd-btn:focus-visible,
.mbxd-icon-btn:focus-visible,
.mbxd-card:focus-visible,
.mbxd-chip:focus-visible,
.mbxd-input:focus-visible,
.mbxd-textarea:focus-visible,
.mbxd-contact:focus-visible {
  outline: 3px solid var(--mbxd-info);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- sabablar */

.mbxd-reasons { display: grid; gap: 8px; }

.mbxd-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--mbxd-target);
  padding: 12px;
  border: 1px solid var(--mbxd-line);
  border-radius: 16px;
  background: var(--mbxd-bg);
  color: var(--mbxd-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mbxd-reason.is-on {
  border-color: var(--mbxd-accent);
  background: #fff8dc;
  box-shadow: inset 0 0 0 2px var(--mbxd-accent);
}

.mbxd-ic { font-style: normal; font-size: 20px; flex: none; }
.mbxd-card-tx { display: grid; gap: 2px; min-width: 0; }
.mbxd-card-title { font-size: 15px; font-weight: 700; }
.mbxd-radio { margin-left: auto; font-size: 18px; color: var(--mbxd-warn); flex: none; }

/* -------------------------------------------------------------- maydonlar */

.mbxd-field { display: grid; gap: 6px; }

.mbxd-field-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--mbxd-ink);
}

.mbxd-textarea, .mbxd-input {
  width: 100%;
  min-height: var(--mbxd-target);
  border: 1px solid var(--mbxd-line);
  border-radius: 12px;
  padding: 12px;
  background: var(--mbxd-soft);
  color: var(--mbxd-ink);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.mbxd-textarea { min-height: 104px; resize: vertical; line-height: 1.45; }
.mbxd-textarea:focus, .mbxd-input:focus { border-color: var(--mbxd-accent); background: var(--mbxd-bg); }

.mbxd-count {
  justify-self: end;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mbxd-muted);
}

.mbxd-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.mbxd-search .mbxd-btn { width: auto; min-width: 96px; }

/* -------------------------------------------------------------- dalillar */

.mbxd-evidence { display: grid; gap: 8px; }

.mbxd-evidence-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
}

.mbxd-evidence-btn { width: 100%; justify-content: flex-start; min-height: var(--mbxd-target); }

.mbxd-evidence-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--mbxd-soft);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.mbxd-st-uploaded { background: #e6f4ea; color: #14532d; }
.mbxd-st-uploading { background: #fff4d6; color: #7a4b00; }
.mbxd-st-failed { background: #fde8e8; color: #8f1d1d; }
.mbxd-st-pending { background: var(--mbxd-soft); color: var(--mbxd-muted); }

.mbxd-consent {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: var(--mbxd-target);
  padding: 8px 10px;
  border: 1px solid var(--mbxd-line);
  border-radius: 12px;
  background: var(--mbxd-soft);
}

.mbxd-consent-input { width: 24px; height: 24px; accent-color: var(--mbxd-accent); }
.mbxd-consent-tx { font-size: 13.5px; font-weight: 600; }

/* ------------------------------------------------------------ holat bloki */

.mbxd-state {
  padding: 12px;
  border-radius: 12px;
  background: var(--mbxd-soft);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.45;
}

.mbxd-state.is-error { background: #fde8e8; color: #8f1d1d; }
.mbxd-state.is-ok { background: #e6f4ea; color: #14532d; }
.mbxd-state.is-warn { background: #fff4d6; color: #7a4b00; }

.mbxd-live { margin: 0; min-height: 18px; font-size: 13px; color: var(--mbxd-muted); }
.mbxd-ok { margin: 0; font-size: 13.5px; font-weight: 700; color: #14532d; }

/* -------------------------------------------------------------- AI tahlil */

.mbxd-ai-badge {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--mbxd-soft);
  font-size: 15px;
  font-weight: 800;
}

/* ⚖️ HUQUQIY IZOH — doim ko'rinadi, ko'zga tashlanadi. */
.mbxd-legal {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 2px solid var(--mbxd-info);
  border-radius: 14px;
  background: #eef3fd;
  color: #12325f;
}

.mbxd-legal-ic { font-size: 22px; line-height: 1; }
.mbxd-legal-tx { font-size: 14px; font-weight: 700; line-height: 1.45; }

.mbxd-ai-summary { display: grid; gap: 8px; }

.mbxd-kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: var(--mbxd-soft);
  border-radius: 12px;
}

.mbxd-kv-k { font-size: 13.5px; color: var(--mbxd-muted); font-weight: 600; }
.mbxd-kv-v { font-size: 15px; font-weight: 800; }

.mbxd-proposal {
  padding: 12px;
  border-left: 5px solid var(--mbxd-accent);
  border-radius: 12px;
  background: #fff8dc;
}

.mbxd-proposal-t { display: block; font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.mbxd-proposal-x { margin: 0; font-size: 14px; line-height: 1.45; }

.mbxd-operator {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--mbxd-line);
  border-radius: 14px;
  background: var(--mbxd-soft);
}

.mbxd-operator-t { font-size: 15px; font-weight: 800; }
.mbxd-operator-x { margin: 0; font-size: 14px; font-weight: 700; }

/* --------------------------------------------------------------- V1–V4 */

.mbxd-levels { display: grid; gap: 10px; }

.mbxd-level {
  display: grid;
  gap: 6px;
  align-items: start;
  cursor: default;
  border-left-width: 6px;
  border-left-style: solid;
}

.mbxd-level-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.mbxd-level-code {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 10px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.mbxd-level-label { font-size: 15px; font-weight: 800; }
.mbxd-level-tone { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--mbxd-muted); }
.mbxd-level-sum { margin: 0; font-size: 14px; }
.mbxd-level-dur { margin: 0; font-size: 13px; color: var(--mbxd-muted); font-weight: 600; }

.mbxd-level-reasons { margin: 2px 0 0; padding-left: 18px; }
.mbxd-level-reason { font-size: 13.5px; line-height: 1.6; }

.mbxd-level-appeal { margin: 4px 0 0; font-size: 13px; font-weight: 700; }

/* V1 — sariq (ogohlantirish) */
.mbxd-v1 { background: #fff8dc; border-color: #e6b800; border-left-color: #ffd21f; }
.mbxd-v1 .mbxd-level-code { background: #7a4b00; }

/* V2 — to'q sariq (jarima) */
.mbxd-v2 { background: #fff1e0; border-color: #d97706; border-left-color: #b45309; }
.mbxd-v2 .mbxd-level-code { background: #b45309; }

/* V3 — qizil (vaqtinchalik blok) */
.mbxd-v3 { background: #fdecec; border-color: #c62828; border-left-color: #c62828; }
.mbxd-v3 .mbxd-level-code { background: #c62828; }

/* V4 — to'q qizil (butunlay blok) */
.mbxd-v4 { background: #f9e3e3; border-color: #7f1d1d; border-left-color: #7f1d1d; }
.mbxd-v4 .mbxd-level-code { background: #7f1d1d; }

.mbxd-appeal {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--mbxd-line);
  border-radius: 14px;
  background: var(--mbxd-soft);
}

.mbxd-appeal-t { font-size: 15px; font-weight: 800; }

/* ------------------------------------------------------------- 1001 yordam */

.mbxd-quick { display: flex; flex-wrap: wrap; gap: 8px; }

.mbxd-chip {
  min-height: var(--mbxd-target);
  padding: 0 14px;
  border: 1px solid var(--mbxd-line);
  border-radius: 999px;
  background: var(--mbxd-bg);
  color: var(--mbxd-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.mbxd-chip:hover { background: #fff8dc; border-color: var(--mbxd-accent); }

.mbxd-help-cards { display: grid; gap: 10px; }

.mbxd-ai-card {
  display: grid;
  gap: 6px;
  align-items: start;
  background: #eef3fd;
  border-color: #c7d7f5;
  cursor: default;
}

.mbxd-ai-card-t { font-size: 15px; font-weight: 800; color: #12325f; }
.mbxd-ai-card-x { margin: 0; font-size: 14px; line-height: 1.5; color: #12325f; }
.mbxd-ai-card .mbxd-note { color: #33507f; font-size: 12.5px; }

.mbxd-op-card {
  display: grid;
  gap: 6px;
  align-items: start;
  background: #e6f4ea;
  border-color: #b7dfc4;
  cursor: default;
}

.mbxd-op-card-t { font-size: 15px; font-weight: 800; color: #14532d; }
.mbxd-op-card-x { margin: 0; font-size: 14px; line-height: 1.5; color: #14532d; }
.mbxd-op-meta { display: flex; gap: 10px; margin: 0; font-size: 12.5px; font-weight: 700; color: #14532d; }

.mbxd-contacts { display: grid; gap: 8px; }

.mbxd-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--mbxd-target);
  padding: 10px 12px;
  border: 1px solid var(--mbxd-line);
  border-radius: 12px;
  background: var(--mbxd-bg);
  color: var(--mbxd-ink);
  text-decoration: none;
  cursor: pointer;
}

.mbxd-contact-ic { font-style: normal; font-size: 20px; flex: none; }
.mbxd-contact-tx { display: grid; gap: 1px; min-width: 0; }
.mbxd-contact-label { font-size: 14.5px; font-weight: 700; }
.mbxd-contact-value { font-size: 12.5px; color: var(--mbxd-muted); }

.mbxd-emergency { display: grid; gap: 8px; padding-top: 4px; }

.mbxd-emergency-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--mbxd-danger);
  border-radius: 14px;
  background: #fdecec;
}

.mbxd-emergency-t { font-size: 15px; font-weight: 800; color: #7f1d1d; }

/* -------------------------------------------------------- tungi rejim (1) */

.mbxd.is-dark,
[data-theme="dark"] .mbxd,
html.mbx-dark .mbxd,
body.mbx-dark .mbxd {
  --mbxd-bg: #15171c;
  --mbxd-soft: #1e2128;
  --mbxd-ink: #f2f4f7;
  --mbxd-muted: #a9b0bb;
  --mbxd-line: #2c3038;
  --mbxd-on-accent: #16181d;
  box-shadow: 0 18px 55px rgb(0 0 0 / 55%);
}

[data-theme="dark"] .mbxd-backdrop,
html.mbx-dark .mbxd-backdrop,
body.mbx-dark .mbxd-backdrop,
.mbxd.is-dark + .mbxd-backdrop { background: rgb(0 0 0 / 62%); }

[data-theme="dark"] .mbxd-reason.is-on,
html.mbx-dark .mbxd-reason.is-on,
body.mbx-dark .mbxd-reason.is-on,
.mbxd.is-dark .mbxd-reason.is-on { background: #3a3415; }

[data-theme="dark"] .mbxd-legal,
html.mbx-dark .mbxd-legal,
body.mbx-dark .mbxd-legal,
.mbxd.is-dark .mbxd-legal { background: #16233c; border-color: #4d7ac9; color: #d6e4ff; }

[data-theme="dark"] .mbxd-ai-card,
html.mbx-dark .mbxd-ai-card,
body.mbx-dark .mbxd-ai-card,
.mbxd.is-dark .mbxd-ai-card { background: #16233c; border-color: #33507f; }

[data-theme="dark"] .mbxd-ai-card-t,
[data-theme="dark"] .mbxd-ai-card-x,
html.mbx-dark .mbxd-ai-card-t,
html.mbx-dark .mbxd-ai-card-x,
.mbxd.is-dark .mbxd-ai-card-t,
.mbxd.is-dark .mbxd-ai-card-x { color: #d6e4ff; }

[data-theme="dark"] .mbxd-op-card,
html.mbx-dark .mbxd-op-card,
body.mbx-dark .mbxd-op-card,
.mbxd.is-dark .mbxd-op-card { background: #12291a; border-color: #2f6b41; }

[data-theme="dark"] .mbxd-op-card-t,
[data-theme="dark"] .mbxd-op-card-x,
html.mbx-dark .mbxd-op-card-t,
html.mbx-dark .mbxd-op-card-x,
.mbxd.is-dark .mbxd-op-card-t,
.mbxd.is-dark .mbxd-op-card-x { color: #c8f0d5; }

[data-theme="dark"] .mbxd-proposal,
html.mbx-dark .mbxd-proposal,
body.mbx-dark .mbxd-proposal,
.mbxd.is-dark .mbxd-proposal { background: #3a3415; }

[data-theme="dark"] .mbxd-state.is-error,
html.mbx-dark .mbxd-state.is-error,
.mbxd.is-dark .mbxd-state.is-error { background: #3a1616; color: #ffd6d6; }

[data-theme="dark"] .mbxd-state.is-ok,
html.mbx-dark .mbxd-state.is-ok,
.mbxd.is-dark .mbxd-state.is-ok { background: #12291a; color: #c8f0d5; }

[data-theme="dark"] .mbxd-state.is-warn,
html.mbx-dark .mbxd-state.is-warn,
.mbxd.is-dark .mbxd-state.is-warn { background: #3a3415; color: #ffe4a3; }

[data-theme="dark"] .mbxd-v1, html.mbx-dark .mbxd-v1, .mbxd.is-dark .mbxd-v1 { background: #2f2a10; }
[data-theme="dark"] .mbxd-v2, html.mbx-dark .mbxd-v2, .mbxd.is-dark .mbxd-v2 { background: #33220f; }
[data-theme="dark"] .mbxd-v3, html.mbx-dark .mbxd-v3, .mbxd.is-dark .mbxd-v3 { background: #331616; }
[data-theme="dark"] .mbxd-v4, html.mbx-dark .mbxd-v4, .mbxd.is-dark .mbxd-v4 { background: #2a1111; }

[data-theme="dark"] .mbxd-emergency-box,
html.mbx-dark .mbxd-emergency-box,
.mbxd.is-dark .mbxd-emergency-box { background: #331616; }

/* -------------------------------------------------------- tungi rejim (2) */

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not(.mbx-light) .mbxd {
    --mbxd-bg: #15171c;
    --mbxd-soft: #1e2128;
    --mbxd-ink: #f2f4f7;
    --mbxd-muted: #a9b0bb;
    --mbxd-line: #2c3038;
    --mbxd-on-accent: #16181d;
    box-shadow: 0 18px 55px rgb(0 0 0 / 55%);
  }

  html:not([data-theme="light"]):not(.mbx-light) .mbxd-reason.is-on { background: #3a3415; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-legal { background: #16233c; border-color: #4d7ac9; color: #d6e4ff; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-ai-card { background: #16233c; border-color: #33507f; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-ai-card-t,
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-ai-card-x { color: #d6e4ff; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-op-card { background: #12291a; border-color: #2f6b41; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-op-card-t,
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-op-card-x { color: #c8f0d5; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-proposal { background: #3a3415; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-v1 { background: #2f2a10; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-v2 { background: #33220f; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-v3 { background: #331616; }
  html:not([data-theme="light"]):not(.mbx-light) .mbxd-v4 { background: #2a1111; }
}

/* -------------------------------------------------------- tungi rejim (3) */

html.mbx-theme-dark .mbxd,
html[data-mbx-theme="dark"] .mbxd {
  --mbxd-bg: #15171c;
  --mbxd-soft: #1e2128;
  --mbxd-ink: #f2f4f7;
  --mbxd-muted: #a9b0bb;
  --mbxd-line: #2c3038;
  --mbxd-on-accent: #16181d;
}

html.mbx-theme-dark .mbxd-proposal,
html[data-mbx-theme="dark"] .mbxd-proposal { background: #3a3415; }

/* ------------------------------------------------------ harakatni kamaytirish */

@media (prefers-reduced-motion: reduce) {
  .mbxd-backdrop, .mbxd, .mbxd-btn { animation: none !important; transition: none !important; }
  .mbxd-btn:hover, .mbxd-btn:active { transform: none; filter: none; }
}

/* --------------------------------------------------------------- planshet */

@media (min-width: 720px) {
  .mbxd-backdrop { align-items: center; }
  .mbxd { border-radius: 18px; max-height: 88vh; padding-bottom: 24px; }
}
