/* Voice — yagona "Tashvish tugmasi" platformasi. Ranglar taqdimotdan olingan. */
:root {
  --navy: #1e2a4a;
  --navy-2: #2b3a63;
  --blue: #3c6bd6;
  --blue-soft: #e8efff;
  --teal: #2fa3b5;
  --green: #4fae4a;
  --lime: #8cc63f;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e3e7ef;
  --bg: #f4f6fb;
  --card: #ffffff;
  --low: #2e9e5b;
  --mid: #e0a100;
  --high: #e8590c;
  --crit: #c92a2a;
  --tile-empty: #e9edf5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --grad: linear-gradient(90deg, var(--blue), var(--teal) 55%, var(--lime));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; letter-spacing: -.02em; color: #fff; font-size: 1.35rem; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 1.1rem; font-weight: 900;
}
.logo small { font-weight: 600; font-size: .7rem; opacity: .75; letter-spacing: .04em; text-transform: uppercase; display: block; }

/* ---------- Ommaviy sahifalar ---------- */
.pub-header { background: var(--navy); color: #fff; }
.pub-header::after { content: ""; display: block; height: 4px; background: var(--grad); }
.pub-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 16px; }
.pub-header nav a { color: #dbe4ff; font-weight: 600; font-size: .9rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; }
.pub-main { padding: 28px 0 48px; }
.pub-footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 24px 16px 32px; }

.hero { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 24px; grid-template-columns: 1.3fr 1fr; align-items: center; }
.hero h1 { font-size: 2rem; }
.hero .tag { display: inline-flex; align-items: center; gap: .4rem; background: #eaf6e7; color: #2f7d2b; font-weight: 700; font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; margin-bottom: .8rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.step { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border-top: 4px solid var(--blue); }
.step:nth-child(2) { border-top-color: var(--teal); }
.step:nth-child(3) { border-top-color: var(--green); }
.step b { display: block; font-size: 1.6rem; color: var(--navy-2); }
.who { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.who span { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; font-weight: 600; font-size: .9rem; }
.notice { background: #fff4e5; border: 1px solid #ffd8a8; color: #8a4b00; border-radius: 12px; padding: 12px 14px; font-size: .9rem; }
.notice.danger { background: #fff0f0; border-color: #ffc9c9; color: #a61e1e; }
.notice.info { background: var(--blue-soft); border-color: #c9d8ff; color: #23408f; }
.anon-box { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(135deg, #eaf6e7, #e6f6f8); border: 1px solid #c7e8cf; color: #1f5f35; border-radius: 14px; padding: 12px 14px; font-size: .9rem; }
.anon-box svg { width: 28px; height: 28px; flex: none; color: var(--green); }
.nav-anon { color: #c9f0c2; font-weight: 700; font-size: .85rem; }

/* ---------- DEMO rejimi ---------- */
.demo-ribbon {
  position: sticky; top: 0; z-index: 50; text-align: center; font-size: .82rem; font-weight: 600;
  padding: .4rem 1rem; color: #4a3200;
  background: repeating-linear-gradient(135deg, #ffd43b 0 18px, #fcc419 18px 36px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.demo-ribbon b { background: #1e2a4a; color: #ffd43b; padding: .1rem .5rem; border-radius: 6px; margin-right: .3rem; letter-spacing: .08em; }
.demo-ribbon a { color: #1e2a4a; font-weight: 800; margin-left: .5rem; text-decoration: underline; }
.is-demo .sidebar { top: 32px; height: calc(100vh - 32px); }
@media (max-width: 760px) { .demo-ribbon { font-size: .72rem; } .is-demo .mobile-head { top: 0; } .is-demo .sidebar { top: auto; height: auto; } }
.done-card { text-align: center; }
.done-icon { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--teal)); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(79, 174, 74, .35); animation: donePop .5s cubic-bezier(.2, .9, .3, 1.4) both; }
.done-icon svg { width: 34px; height: 34px; }
@keyframes donePop { from { transform: scale(.4); opacity: 0; } }

/* ---------- Kartalar, formalar ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 12px; }
.card-title h2 { margin: 0; }
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .35rem; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid #cfd6e4; border-radius: 10px; padding: .6rem .75rem;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #c9d8ff; border-color: var(--blue); }
.field { margin-bottom: 14px; }
.errorlist { list-style: none; padding: 0; margin: .3rem 0 0; color: var(--crit); font-size: .85rem; }
.radio-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; list-style: none; padding: 0; margin: 0; }
.radio-cards div, .radio-cards li { margin: 0; }
.radio-cards label { display: flex; align-items: center; gap: .5rem; border: 1px solid #cfd6e4; border-radius: 10px; padding: .6rem .7rem; cursor: pointer; font-weight: 600; margin: 0; }
.radio-cards label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700; cursor: pointer;
  border: 0; border-radius: 10px; padding: .65rem 1.1rem; background: var(--blue); color: #fff; text-decoration: none; line-height: 1.2;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.big { padding: .9rem 1.3rem; font-size: 1.02rem; width: 100%; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid #c9d8ff; }
.btn.light { background: var(--blue-soft); color: var(--blue); }
.btn.danger { background: var(--crit); }
.btn.green { background: var(--green); }
.btn.sm { padding: .4rem .7rem; font-size: .85rem; }
.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 1.8rem; font-weight: 800; letter-spacing: .08em; text-align: center; padding: 18px; border: 2px dashed var(--blue); border-radius: 14px; background: var(--blue-soft); color: var(--navy); margin: 14px 0; user-select: all; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; }
.org-results { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.org-results a { display: flex; justify-content: space-between; gap: 1rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; color: var(--ink); font-weight: 600; }

/* ---------- Xabarlar (yozishma) ---------- */
.thread { display: grid; gap: 10px; margin: 10px 0 16px; }
.bubble { max-width: 85%; padding: .7rem .9rem; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); white-space: pre-wrap; }
.bubble.staff { background: var(--blue-soft); border-color: #c9d8ff; justify-self: start; }
.bubble.reporter { justify-self: end; }
.bubble .meta { display: block; font-size: .75rem; color: var(--muted); margin-top: .3rem; white-space: normal; }

/* ---------- Statuslar va xavf belgilari ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; background: var(--tile-empty); color: var(--ink); }
.badge.low { background: #e3f6ea; color: #1f7a45; }
.badge.mid { background: #fff3cf; color: #8a6100; }
.badge.high { background: #ffe8d9; color: #b3460a; }
.badge.crit { background: #ffe0e0; color: #a61e1e; }
.badge.threat { background: var(--crit); color: #fff; }
.badge.st-yangi, .badge.st-tahlil { background: var(--blue-soft); color: #23408f; }
.badge.st-yonaltirildi, .badge.st-jarayonda { background: #e6f6f8; color: #146b78; }
.badge.st-hal_qilindi { background: #e3f6ea; color: #1f7a45; }
.badge.st-yopildi { background: #eef0f4; color: #4a5468; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- Markaz paneli ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #c9d3ee; padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { color: #c9d3ee; padding: .6rem .75rem; border-radius: 10px; font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: .6rem; }
.sidebar nav a:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.sidebar .me { margin-top: auto; font-size: .82rem; border-top: 1px solid #34436f; padding-top: 12px; }
.sidebar .me b { color: #fff; display: block; }
.sidebar .me button { background: none; border: 0; color: #9fb3ff; padding: 0; font: inherit; cursor: pointer; margin-top: .4rem; }
.sidebar svg { width: 18px; height: 18px; flex: none; }
.main { padding: 22px 26px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { margin: 0; }
.messages { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.messages li { padding: .7rem .9rem; border-radius: 10px; background: #e3f6ea; color: #1f7a45; font-weight: 600; }
.messages li.error { background: #ffe0e0; color: #a61e1e; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.kpi b { display: block; font-size: 1.7rem; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.kpi.alert b { color: var(--crit); }
.kpi.alert { border-left: 4px solid var(--crit); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr 44px; gap: 10px; align-items: center; font-size: .86rem; }
.bar-track { background: var(--tile-empty); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--grad); border-radius: 999px; }
.bar-fill.r1 { background: var(--low); } .bar-fill.r2 { background: var(--mid); } .bar-fill.r3 { background: var(--high); } .bar-fill.r4 { background: var(--crit); }
.bar-row b { text-align: right; }

.trend { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 6px; border-bottom: 1px solid var(--line); }
.trend .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.trend .col i { display: block; background: #bfd0f7; border-radius: 3px 3px 0 0; min-height: 0; }
.trend .col i.hi { background: var(--high); border-radius: 0; }
.trend-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:hover td { background: #fafbff; }
.tbl .summary { max-width: 440px; }
.tbl a.row-link { color: var(--ink); font-weight: 600; }
.table-wrap { overflow-x: auto; }

.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 10px; align-items: end; }
.filters .field { margin: 0; }
.filters label { font-size: .78rem; color: var(--muted); }
.filters .checks { display: flex; gap: 14px; align-items: center; grid-column: span 2; }
.filters .checks label { display: inline-flex; gap: .4rem; align-items: center; margin: 0; color: var(--ink); }
.filters .actions { display: flex; gap: 8px; }
.sortbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.sortbar a { padding: .3rem .65rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.sortbar a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.sortbar select { width: auto; padding: .45rem .6rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; font-size: .9rem; }

.detail { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.report-text { white-space: pre-wrap; font-size: 1rem; background: var(--bg); border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; margin: 0; }
.facts dt { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.facts dd { margin: 0 0 4px; font-weight: 600; }
.ai-box { border: 1px solid #c9d8ff; background: linear-gradient(180deg, #f5f8ff, #fff); border-radius: 12px; padding: 14px 16px; }
.ai-box h3 { display: flex; gap: .4rem; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .78rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .15rem .55rem; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: .86rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.k-routed::before { background: var(--teal); }
.timeline li.k-status::before { background: var(--green); }
.timeline li.k-reporter_msg::before, .timeline li.k-reply::before { background: var(--mid); }
.timeline .when { color: var(--muted); font-size: .76rem; }
.action-form { display: grid; gap: 10px; }
.action-form .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
details.action { border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: 12px; }
details.action summary { cursor: pointer; font-weight: 700; color: var(--navy-2); list-style: none; }
details.action summary::-webkit-details-marker { display: none; }
details.action summary::before { content: "▸ "; color: var(--blue); }
details.action[open] summary::before { content: "▾ "; }
details.action > form { margin-top: 10px; }
.check-inline { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.check-inline input { width: auto; }

/* ---------- Xavf xaritasi ---------- */
.tilemap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 104px; gap: 8px; }
.tile { border-radius: 12px; padding: 10px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; text-shadow: 0 1px 2px rgba(0,0,0,.25); box-shadow: var(--shadow); position: relative; }
.tile.empty { color: var(--muted); text-shadow: none; }
.tile b { font-size: .82rem; line-height: 1.15; }
.tile .num { font-size: 1.5rem; font-weight: 800; }
.tile .sub { font-size: .7rem; opacity: .95; }
.tile .pilot { position: absolute; bottom: 8px; right: 8px; background: rgba(255,255,255,.9); color: var(--navy); text-shadow: none; font-size: .62rem; font-weight: 800; padding: .1rem .35rem; border-radius: 6px; }
/* ---------- 3D xavf xaritasi ---------- */
.map-card {
  position: relative; overflow: hidden; padding: 14px 20px 16px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(60, 107, 214, .10) 0%, rgba(60, 107, 214, 0) 70%),
    linear-gradient(180deg, #f6f8fe 0%, #ffffff 65%);
}
.map-card:fullscreen { display: flex; flex-direction: column; justify-content: center; border-radius: 0; padding: 2vh 3vw; }
.map-card:fullscreen .map-stage { flex: 1; display: flex; align-items: center; }
.map-card:fullscreen .map-tilt { width: min(100%, 150vh); margin-inline: auto; }
.map-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; position: relative; z-index: 3; }
.map-title { margin: 0 auto 0 0; font-size: 1.15rem; }
.map-title a { color: var(--ink); }
.dash-map-row { margin-bottom: 16px; align-items: stretch; }

/* ---------- Hudud paneli (xaritada bosilganda o'ngda) ---------- */
.region-panel { position: relative; display: flex; flex-direction: column; overflow: hidden !important; contain: size; min-height: 360px; padding: 16px; }
.dash-map-row { grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); }
.region-panel > .rp-default, .region-panel > .rp-detail { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.region-panel > [hidden] { display: none; }
.region-panel.is-loading::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 35%; z-index: 2;
  background: var(--grad); animation: rpLoad .9s ease-in-out infinite;
}
@keyframes rpLoad { from { left: -35%; } to { left: 100%; } }
.rp-hint { background: var(--blue-soft); color: #23408f; border-radius: 10px; padding: .55rem .75rem; font-size: .84rem; font-weight: 600; margin: 0 0 14px; }
.rp { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rp-dot { width: 14px; height: 14px; border-radius: 5px; flex: none; background: var(--blue); box-shadow: 0 0 0 4px rgba(30, 42, 74, .06); }
.rp-title { flex: 1; min-width: 0; }
.rp-title h2 { margin: 0; font-size: 1.15rem; }
.rp-close { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 1.35rem; line-height: 1; cursor: pointer; color: var(--muted); flex: none; transition: background .15s, color .15s; }
.rp-close:hover, .rp-close:focus-visible { background: var(--line); color: var(--ink); }
.rp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.rp-stats div { background: var(--bg); border-radius: 10px; padding: 6px 8px; }
.rp-stats b { display: block; font-size: 1.2rem; font-weight: 800; color: var(--navy); line-height: 1.15; }
.rp-stats span { font-size: .7rem; color: var(--muted); font-weight: 700; }
.rp-stats .warn b { color: var(--high); }
.rp-stats .crit { background: #fff0f0; }
.rp-stats .crit b { color: var(--crit); }
.rp-cats { margin-bottom: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.rp-cats::-webkit-scrollbar { display: none; }
.rp-cats .chip { white-space: nowrap; }
.rp-sub { margin: 2px 0 8px; font-size: .9rem; flex: none; }
.rp-head, .rp-stats { flex: none; }
.rp-list { list-style: none; margin: 0 -6px; padding: 2px 6px 6px; display: grid; gap: 8px; align-content: start; overflow-y: auto; flex: 1; min-height: 0; }
.rp-item { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; transition: border-color .15s, transform .15s, box-shadow .15s; }
.rp-item:hover, .rp-item:focus-visible { border-color: #c9d8ff; box-shadow: var(--shadow); transform: translateX(-3px); text-decoration: none; }
.rp-item.is-threat { background: linear-gradient(90deg, #fff5f5, #fff 40%); border-color: #ffd0d0; }
.rp-risk { width: 5px; border-radius: 4px; flex: none; background: var(--tile-empty); }
.rp-risk.low { background: var(--low); } .rp-risk.mid { background: var(--mid); } .rp-risk.high { background: var(--high); } .rp-risk.crit { background: var(--crit); }
.rp-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rp-text { font-weight: 600; font-size: .88rem; line-height: 1.35; }
.rp-meta { font-size: .74rem; color: var(--muted); }
.rp-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.rp-empty { margin: 8px 0; }
.rp-all { margin-top: 12px; align-self: flex-start; flex: none; }
.rp-anim .rp { animation: rpIn .35s cubic-bezier(.2, .8, .2, 1); }
.rp-anim .rp-list li { animation: rpIn .4s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--d) * 35ms + 80ms); }
@keyframes rpIn { from { opacity: 0; transform: translateX(18px); } }
.rp-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rp-top button { width: 100%; display: flex; align-items: center; gap: 10px; font: inherit; text-align: left; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; color: var(--ink); transition: border-color .15s, background .15s; }
.rp-top button:hover, .rp-top button:focus-visible { border-color: #c9d8ff; background: #fafbff; }
.rp-top i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.rp-top span { flex: 1; font-weight: 600; font-size: .9rem; }
.rp-top em { font-style: normal; }
@media (prefers-reduced-motion: reduce) { .rp-anim .rp, .rp-anim .rp-list li { animation: none; } }

/* Tanlangan hudud xaritada ajralib turadi, qolganlari xiralashadi */
.uzmap .region-link.selected .region { stroke: var(--navy); stroke-width: 3.2; }
.map-stage[data-mode="3d"] .uzmap .region-link.selected .top { transform: translateY(-13px); filter: brightness(1.08) drop-shadow(0 14px 12px rgba(20, 30, 60, .38)); }
.map-stage[data-mode="2d"] .uzmap .region-link.selected .top { transform: translateY(-3px); filter: drop-shadow(0 6px 8px rgba(20, 30, 60, .32)); }
.uzmap .region-link .top { transition: transform .28s cubic-bezier(.2, .8, .2, 1.2), filter .28s, opacity .3s; }
.map-stage.has-selection .uzmap .region-link:not(.selected):not(:hover) .top { opacity: .45; }

/* TV rejimi: 2D xarita, yirikroq yozuvlar */
.app.tv .uzmap .map-num { font-size: 28px; }
.app.tv .uzmap .map-name { font-size: 14px; }
.app.tv .map-stage[data-mode="2d"] .map-tilt { margin: 0; }
.dash-map-row > .map-card { margin: 0; }
.dash-row { margin-bottom: 0; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn { border: 0; background: transparent; font: inherit; font-weight: 800; font-size: .8rem; padding: .32rem .8rem; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg-btn[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(16, 24, 40, .15); }

.map-stage { position: relative; perspective: 1900px; perspective-origin: 50% 45%; padding: 0 3%; --ry: 0deg; --rx-extra: 0deg; }
.map-tilt { position: relative; transform-style: preserve-3d; transform-origin: 50% 58%; transition: transform .7s cubic-bezier(.2, .8, .2, 1), margin .7s; }
.map-tilt::before {
  content: ""; position: absolute; inset: -6% -3%; pointer-events: none; opacity: 0; transition: opacity .6s;
  background-image: linear-gradient(rgba(60, 107, 214, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 107, 214, .09) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 40%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 50%, #000 40%, transparent 75%);
}
.map-stage[data-mode="3d"] .map-tilt {
  transform: rotateX(calc(36deg + var(--rx-extra))) rotateY(var(--ry)) scale(.95);
  margin: -3% 0 -4%;
  animation: mapTiltIn 1.2s cubic-bezier(.2, .8, .2, 1) backwards;
}
.map-stage[data-mode="3d"] .map-tilt::before { opacity: 1; }
@keyframes mapTiltIn { from { transform: rotateX(0deg) scale(.86); opacity: 0; } 40% { opacity: 1; } }

.uzmap { width: 100%; height: auto; display: block; overflow: visible; }
.uzmap .ground { fill: #1e2a4a; opacity: .22; filter: url(#groundBlur); }
.uzmap .extrude { animation: mapFade .8s .25s backwards; }
.map-stage[data-mode="2d"] .uzmap .extrude { display: none; }
.map-stage[data-mode="2d"] .uzmap .ground { opacity: .1; }
.uzmap .region { stroke: rgba(255, 255, 255, .92); stroke-width: 1.4; stroke-linejoin: round; cursor: pointer; }
.uzmap .region.empty { stroke: #cfd7e6; }
.uzmap .sheen { pointer-events: none; }
.uzmap .region-link .top { transition: transform .28s cubic-bezier(.2, .8, .2, 1.2), filter .28s; }
.map-stage[data-mode="3d"] .uzmap .region-link .top { animation: regionRise .85s cubic-bezier(.2, .9, .25, 1.15) backwards; animation-delay: calc(var(--i) * 65ms + 250ms); }
@keyframes regionRise { from { transform: translateY(-60px); opacity: 0; } 60% { opacity: 1; } }
.uzmap .region-link:hover .top, .uzmap .region-link:focus .top { transform: translateY(-10px); filter: brightness(1.08) saturate(1.12) drop-shadow(0 12px 10px rgba(20, 30, 60, .35)); }
.map-stage[data-mode="2d"] .uzmap .region-link:hover .top, .map-stage[data-mode="2d"] .uzmap .region-link:focus .top { transform: translateY(-3px); }
.uzmap .region-link:focus { outline: none; }
.uzmap .region-link:focus-visible .region { stroke: var(--navy); stroke-width: 3; }
.uzmap .label { animation: mapFade .6s backwards; animation-delay: calc(var(--i) * 65ms + 700ms); }
.uzmap .billboard { transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.map-stage[data-mode="3d"] .uzmap .billboard { transform: scaleY(1.24); }
@keyframes mapFade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .map-tilt, .uzmap .extrude, .uzmap .label, .map-stage[data-mode="3d"] .uzmap .region-link .top, .map-stage[data-mode="3d"] .map-tilt { animation: none !important; transition: none !important; }
}
.uzmap .pilot-tag rect { fill: var(--navy); }
.uzmap .label .pilot-tag text { fill: #fff; stroke: none; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.uzmap .callout .pilot-tag text { fill: #fff; stroke: none; }
.uzmap .map-labels { pointer-events: none; }
.uzmap .label text { text-anchor: middle; paint-order: stroke; stroke: rgba(22, 32, 60, .55); stroke-width: 3.5px; stroke-linejoin: round; fill: #fff; }
.uzmap .map-num { font-size: 24px; font-weight: 800; }
.uzmap .map-name { font-size: 12.5px; font-weight: 700; }
.uzmap .callout text { fill: var(--navy); stroke: #fff; stroke-width: 4px; }
.uzmap .leader { stroke: var(--navy); stroke-width: 1.3; opacity: .7; }
.uzmap .leader-dot { fill: var(--navy); stroke: #fff; stroke-width: 1.5; }
.uzmap .pulse { fill: none; stroke: #fff; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: mapPulse 2.2s ease-out infinite; }
@keyframes mapPulse { 0% { transform: scale(.6); opacity: .95; } 100% { transform: scale(3.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .uzmap .pulse { animation: none; opacity: .8; } }
.map-tip { position: absolute; z-index: 5; min-width: 220px; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .18); padding: 12px 14px; font-size: .84rem; pointer-events: none; border: 1px solid var(--line); }
.map-tip .tip-head { display: flex; align-items: center; gap: .45rem; margin-bottom: 8px; }
.map-tip .tip-head i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.map-tip .tip-grid { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; }
.map-tip .tip-grid span { color: var(--muted); }
.map-tip .tip-grid b.crit { color: var(--crit); }
.map-tip .tip-foot { margin-top: 8px; color: var(--blue); font-size: .76rem; font-weight: 600; }
.map-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.map-legend { width: 300px; max-width: 100%; }
.legend .legend-pilot::before { background: var(--navy); }
.legend .legend-pulse::before { background: var(--crit); border-radius: 50%; box-shadow: 0 0 0 3px rgba(201, 42, 42, .2); }
.scale { height: 10px; border-radius: 999px; background: linear-gradient(90deg, rgb(46,160,67), rgb(240,180,41), rgb(214,48,49)); }
.scale-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }

/* ---------- Kirish sahifasi ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .logo { color: var(--navy); margin-bottom: 14px; }

/* ---------- QR plakat ---------- */
.poster { background: #fff; border-radius: 18px; box-shadow: var(--shadow); max-width: 560px; margin: 0 auto; overflow: hidden; text-align: center; }
.poster-head { background: var(--navy); color: #fff; padding: 22px; }
.poster-head::after { content: ""; display: block; height: 4px; margin: 16px -22px -22px; background: var(--grad); }
.poster-body { padding: 24px; }
.poster svg { width: 280px; height: 280px; }
.poster .org { font-weight: 800; font-size: 1.1rem; }

/* ---------- QR to'plami (chop etish uchun) ---------- */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.qr-card svg { width: 170px; height: 170px; display: block; margin: 6px auto; }
.qr-card-head { display: flex; align-items: center; justify-content: center; gap: .4rem; font-size: .78rem; color: var(--navy); }
.qr-card-head .logo-mark { width: 22px; height: 22px; font-size: .75rem; border-radius: 6px; }
.qr-card-org { font-weight: 800; font-size: .9rem; line-height: 1.25; }
.qr-card-meta { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.qr-card-hint { font-size: .72rem; margin-top: 6px; color: var(--navy-2); font-weight: 600; }

@media print {
  .qr-sheet { grid-template-columns: repeat(3, 1fr); gap: 8mm; }
  .qr-card { border: 1px dashed #999; border-radius: 0; }
  .logo-mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .no-print, .topbar .btn { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .poster { box-shadow: none; }
  body { background: #fff; }
  .mobile-head { display: none !important; }
}

/* =====================================================================
   MOSLASHUVCHAN DIZAYN: telefon · planshet · kompyuter · katta ekran / TV
   ===================================================================== */

/* Umumiy: grid ichidagi bloklar torayishi mumkin, jadvallar kartadan chiqmaydi */
.grid-2 > *, .grid-3 > *, .detail > *, .stack > * { min-width: 0; }
.grid-2 > .card, .grid-3 > .card, .stack > .card { overflow-x: auto; }
.grid-2 > .map-card, .grid-3 > .map-card { overflow: hidden; }
.mobile-head { display: none; }
.show-sm { display: none !important; }
@media (max-width: 760px) { .show-sm { display: inline-flex !important; } .hide-sm { display: none !important; } }
.tv-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.tv-bar .logo { color: var(--navy); }
.tv-clock { font-weight: 700; color: var(--muted); }

/* --- TV / katta dashboard rejimi (?tv=1) --- */
.app.tv { grid-template-columns: 1fr; }
.app.tv .sidebar, .app.tv .mobile-head { display: none; }
.app.tv .main { padding: 2vh 2.4vw; }
.app.tv .topbar .btn, .app.tv .no-tv { display: none; }

/* --- Katta monitor: ≥ 1600px --- */
@media (min-width: 1600px) {
  body { font-size: 16px; }
  .app { grid-template-columns: 260px 1fr; }
  .main { padding: 28px 36px 48px; }
  .kpi b { font-size: 2rem; }
  .grid-3 { grid-template-columns: 2.2fr 1fr; }
  .trend { height: 180px; }
}
/* --- Katta dashboard ekran / TV: ≥ 2200px (2K, 4K) --- */
@media (min-width: 2200px) {
  body { font-size: 19px; }
  .app { grid-template-columns: 300px 1fr; }
  .sidebar svg { width: 22px; height: 22px; }
  .kpis { gap: 18px; }
  .kpi { padding: 20px 24px; }
  .kpi b { font-size: 2.6rem; }
  .card { padding: 26px; border-radius: 18px; }
  .trend { height: 240px; }
  .grid-2, .grid-3 { gap: 22px; }
}

/* --- Kichik noutbuk: ≤ 1280px --- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 1fr 1fr 1fr; }
  .filters .field:first-child { grid-column: span 3; }
  .filters .checks { grid-column: span 2; }
}

/* --- Planshet: ≤ 1024px — yon menyu faqat ikonkalar --- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 72px 1fr; }
  .sidebar { padding: 16px 10px; align-items: center; }
  .sidebar .nav-label, .sidebar .me-role, .sidebar .me b { display: none; }
  .sidebar nav a { justify-content: center; padding: .7rem; }
  .sidebar svg { width: 22px; height: 22px; }
  .sidebar .me { text-align: center; font-size: .72rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .region-panel { contain: none; min-height: 0; }
  .region-panel > .rp-default, .region-panel > .rp-detail, .rp-list { overflow: visible; }
  .main { padding: 18px 20px 32px; }
}

/* --- Telefon: ≤ 760px — pastki menyu paneli, kartochkali ro'yxat --- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .mobile-head {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between;
    background: var(--navy); padding: 10px 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  }
  .mobile-head .logo { font-size: 1.15rem; }
  .mobile-head .logo-mark { width: 30px; height: 30px; }
  .mh-user { background: rgba(255, 255, 255, .1); border: 0; color: #dbe4ff; font: inherit; font-size: .8rem; font-weight: 600; padding: .4rem .7rem; border-radius: 999px; cursor: pointer; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; top: auto; height: auto;
    flex-direction: row; justify-content: center; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .18);
  }
  .sidebar > .logo, .sidebar .me { display: none; }
  .sidebar nav { display: flex; width: 100%; justify-content: space-around; gap: 2px; }
  .sidebar nav a { flex: 1; flex-direction: column; gap: 3px; padding: .4rem .2rem; font-size: .66rem; border-radius: 10px; text-align: center; }
  .sidebar .nav-label { display: block; white-space: nowrap; }
  .sidebar svg { width: 22px; height: 22px; }
  .main { padding: 14px 14px 24px; }
  .topbar { margin-bottom: 12px; }
  .topbar h1 { font-size: 1.3rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 1.45rem; }
  .grid-2, .grid-3, .detail, .hero { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .steps { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child, .filters .checks, .filters .actions { grid-column: span 2; }
  .filters .checks { flex-wrap: wrap; }
  .bar-row { grid-template-columns: 1fr 1.1fr 36px; }
  .facts { grid-template-columns: 1fr; }
  .trend { height: 110px; gap: 2px; }
  .sortbar { gap: 4px; }

  /* Xabarlar jadvali -> kartochkalar */
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards thead { display: none; }
  .tbl.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  .tbl.cards td { border: 0; padding: 3px 0; }
  .tbl.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .75rem; font-weight: 700; }
  .tbl.cards td.hide-sm { display: none; }
  .tbl.cards .summary { max-width: none; }

  /* Xarita: kichik ekranda raqamlar yirikroq, nomlar tugmachada (bosganda) */
  .map-card { padding: 12px; }
  .map-stage { padding: 0; perspective: 1100px; }
  .map-stage[data-mode="3d"] .map-tilt { transform: rotateX(calc(28deg + var(--rx-extra))) scale(.98); margin: -2% 0 -3%; }
  .map-stage[data-mode="3d"] .uzmap .billboard { transform: scaleY(1.14); }
  .uzmap .map-num { font-size: 38px; }
  .uzmap .label:not(.callout) .map-name, .uzmap .pilot-tag { display: none; }
  .uzmap .callout .map-name { font-size: 20px; }
  .map-foot { flex-direction: column; align-items: stretch; }
  .map-legend { width: 100%; }
  .map-tip { min-width: 0; width: calc(100% - 8px); left: 4px !important; }
  .poster svg { width: 220px; height: 220px; }
}

/* --- Kichik telefon: ≤ 400px --- */
@media (max-width: 400px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi span { font-size: .72rem; }
  .filters { grid-template-columns: 1fr; }
  .filters .field:first-child, .filters .checks, .filters .actions { grid-column: auto; }
  .who { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
}

