:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --border: #d9dee7;
  --primary: #0d47a1;
  --primary-2: #1565c0;
  --primary-soft: #e3edfb;
  --danger: #c62828;
  --ok: #2e7d32;
  --warn: #e65100;
  --side: #0b2a5b;
  --side-text: #c9d6ee;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 14px; font-weight: 600; }
h2 { font-size: 17px; margin: 18px 0 10px; font-weight: 600; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
.err { color: var(--danger); }
.splash { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ------------------------------------------------ кнопкалар ва майдонлар */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--primary-2); color: var(--primary-2); }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.link { border: 0; background: none; color: var(--primary-2); padding: 4px 0; text-decoration: underline; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #90caf9; border-color: var(--primary-2); }
textarea { resize: vertical; min-height: 64px; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar .grow { flex: 1 1 200px; }
.toolbar label.f { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.spacer { flex: 1; }
.total { font-weight: 600; }

/* ------------------------------------------------ асосий тузилма */
.shell { display: grid; grid-template-columns: 270px 1fr; grid-template-rows: 54px 1fr; height: 100vh; }
.topbar {
  grid-column: 1 / 3; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--primary); color: #fff;
}
.topbar .logo { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.topbar .org { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); padding: 5px 10px; }
.topbar .btn:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }

.sidebar { background: var(--side); color: var(--side-text); overflow-y: auto; padding: 8px 0 20px; }
.sidebar .group { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; padding: 14px 18px 6px; color: #7f97c2; }
.sidebar a {
  display: flex; gap: 10px; align-items: center; padding: 7px 18px; color: var(--side-text);
  text-decoration: none; border-left: 3px solid transparent;
}
.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: #ffca28; }
.sidebar .ico { width: 20px; text-align: center; }

.main { overflow: auto; padding: 20px 24px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* ------------------------------------------------ карточкалар */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card .v { font-size: 28px; font-weight: 700; color: var(--primary); }
.card .c { color: var(--muted); }

/* ------------------------------------------------ жадвал */
.tablewrap {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: auto; max-height: calc(100vh - 230px);
}
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { padding: 6px 10px; border-bottom: 1px solid #eef1f5; text-align: left; vertical-align: top; }
table.grid th {
  position: sticky; top: 0; background: #eef3fa; font-weight: 600; cursor: pointer; user-select: none;
  white-space: nowrap; z-index: 1; border-bottom: 1px solid var(--border);
}
table.grid th .arrow { color: var(--primary-2); font-size: 11px; }
table.grid td.num, table.grid th.num { text-align: right; white-space: nowrap; }
table.grid tbody tr:nth-child(even) { background: #fafbfd; }
table.grid tbody tr:hover { background: #eef5ff; }
table.grid tbody tr.sel { background: #d6e6fb; }
table.grid td.badge span, .badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px; color: #fff; font-size: 12px; font-weight: 600;
}
table.grid .empty { text-align: center; color: var(--muted); padding: 30px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid #0002; }
.count { color: var(--muted); margin-top: 6px; font-size: 13px; }

/* ------------------------------------------------ таблар */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tabs button {
  border: 1px solid transparent; border-bottom: 0; background: none; padding: 8px 14px; cursor: pointer;
  border-radius: 6px 6px 0 0; color: var(--muted);
}
.tabs button.active { background: var(--panel); border-color: var(--border); color: var(--text); font-weight: 600; margin-bottom: -1px; }

/* ------------------------------------------------ модал */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 25, 45, .45); display: grid; place-items: center;
  z-index: 50; padding: 16px;
}
.modal {
  background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
  width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
}
.modal.wide { width: min(920px, 100%); }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 16px; }
.modal .body { padding: 16px 18px; overflow: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.form { display: grid; grid-template-columns: 190px 1fr; gap: 10px 12px; align-items: center; }
.form > label { color: var(--muted); }
.form > label.req::after { content: " *"; color: var(--danger); }
.form .full { grid-column: 1 / 3; }
.form .preview { font-weight: 600; color: var(--primary-2); }
.ssel { display: flex; flex-direction: column; gap: 4px; }
.ssel input { font-size: 13px; padding: 4px 8px; }
.toolbar .ssel { flex-direction: row; }
.toolbar .ssel input { width: 110px; padding: 7px 9px; }

/* ------------------------------------------------ кириш ойналари */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px 30px;
  width: min(520px, 100%); box-shadow: 0 10px 30px rgba(13, 71, 161, .08);
}
.auth h1 { color: var(--primary); text-align: center; }
.auth .sub { text-align: center; color: var(--muted); margin: -8px 0 18px; }
.auth .form { grid-template-columns: 150px 1fr; }
.auth .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.code {
  font: 700 20px/1.2 Consolas, "Courier New", monospace; letter-spacing: 1px; padding: 10px 12px;
  background: #f4f7fc; border: 1px dashed var(--primary-2); border-radius: 8px; text-align: center;
  user-select: all; word-break: break-all;
}
.status-ok { color: var(--ok); font-weight: 600; }
.status-bad { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------ огоҳлантиришлар */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: #263238; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px;
  box-shadow: 0 6px 18px rgba(0,0,0,.2); animation: tin .2s ease-out;
}
.toast.ok { background: var(--ok); }
.toast.error { background: var(--danger); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 54px auto 1fr; }
  .sidebar { max-height: 180px; }
  .topbar .org { display: none; }
  .form, .auth .form { grid-template-columns: 1fr; }
  .form .full { grid-column: 1; }
}
@media print {
  .sidebar, .topbar, .toolbar, .tabs { display: none !important; }
  .shell { display: block; }
  .tablewrap { max-height: none; border: 0; }
}

/* ------------------------------------------------ ҳисоботлар: карточкалар ва диаграммалар */
.rep-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.rep-head h1 { margin-bottom: 6px; }
.rep-period { color: var(--muted); }
.toolbar.filters { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat .s-label { color: var(--muted); font-size: 13px; }
.stat .s-value { font-size: 28px; font-weight: 600; color: var(--text); line-height: 1.25; margin-top: 2px; }
.stat .s-note { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.accent { background: var(--primary); border-color: var(--primary); }
.stat.accent .s-label, .stat.accent .s-note { color: #c9daf5; }
.stat.accent .s-value { color: #fff; font-size: 34px; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chartcard { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 10px; min-width: 0; }
.chartcard.wide { grid-column: 1 / -1; }
.cc-head { margin-bottom: 8px; }
.cc-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.cc-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chartbox { width: 100%; }
.chartempty { color: var(--muted); padding: 28px 0; text-align: center; }
svg.chart { display: block; font-family: inherit; }
svg.chart .tick { font-size: 11px; fill: #898781; font-variant-numeric: tabular-nums; }
svg.chart .lbl { font-size: 12.5px; fill: #52514e; }
svg.chart .val { font-size: 12px; fill: #0b0b0b; font-weight: 600; font-variant-numeric: tabular-nums; }
svg.chart .reflbl { font-size: 11px; fill: #52514e; }
svg.chart .hit { cursor: default; }
svg.chart .hit:hover { fill: rgba(42, 120, 214, .06); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.charttip {
  position: fixed; z-index: 200; pointer-events: none; display: none; background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14); max-width: 320px;
}
.charttip .t { font-weight: 600; margin-bottom: 2px; }
.rep-tables { margin-top: 22px; }

.meter { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 130px; }
.meter .track { position: relative; flex: 1; height: 6px; background: #e3edfb; border-radius: 3px; max-width: 90px; }
.meter .track span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary-2); border-radius: 3px; }
.meter .track .mark { position: absolute; left: 66.6%; top: -3px; bottom: -3px; width: 1px; background: #52514e; }
.meter b { font-weight: 600; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.place { white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .charts { grid-template-columns: 1fr; } }
@media print {
  .charts { grid-template-columns: 1fr 1fr; }
  .chartcard, .stat { break-inside: avoid; }
  .stat.accent { background: #fff; border-color: var(--border); }
  .stat.accent .s-value { color: var(--text); }
  .stat.accent .s-label, .stat.accent .s-note { color: var(--muted); }
  .main { overflow: visible; padding: 0; }
}
/* ------------------------------------------------ расмлар */
.ava { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; background: #e3edfb; vertical-align: middle; }
.ava.ini { display: inline-grid; place-items: center; color: var(--primary); font-weight: 600; letter-spacing: .5px; }
.person { display: inline-flex; align-items: center; gap: 8px; }
.photo-edit { display: flex; gap: 14px; align-items: center; }
.photo-edit .hint { margin: 6px 0 0; }

/* ------------------------------------------------ кесим танлагич */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 16px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--primary); color: #fff; font-weight: 600; }
.toolbar.filters + .toolbar.filters { margin-top: -2px; }
.tlabel { color: var(--muted); }
.toolbar label.f .ssel select { min-width: 260px; }

/* ------------------------------------------------ хулосалар ва энг яхшилар */
.two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; margin-bottom: 14px; }
.two > :only-child { grid-column: 1 / -1; }
.insights ol { margin: 4px 0 6px; padding-left: 22px; }
.insights li { margin: 5px 0; line-height: 1.5; }
.pod { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; padding: 6px 0 4px; }
.pod-item { text-align: center; padding: 12px 6px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pod-item:hover { background: #f3f7fd; }
.pod-item.p1 { background: linear-gradient(#fff8e1, #fff); }
.pod-item .medal { font-size: 22px; line-height: 1; }
.pod-name { font-weight: 600; line-height: 1.25; }
.pod-kpi { font-size: 22px; font-weight: 700; color: var(--primary); }

/* ------------------------------------------------ ходим профили */
.profile {
  display: flex; align-items: center; gap: 20px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; margin: 14px 0;
}
.profile .pr-info { flex: 1; min-width: 0; }
.profile .pr-name { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.profile .pr-kpi { text-align: right; }
.profile .pr-big { font-size: 42px; font-weight: 700; color: var(--primary); line-height: 1.1; margin-bottom: 4px; }
.profile .s-label { color: var(--muted); }

@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
@media print { .seg, .toolbar.filters { display: none !important; } .two { grid-template-columns: 1fr 1fr; } }
/* ------------------------------------------------ Face ID */
.cam { position: relative; width: 100%; max-width: 440px; aspect-ratio: 4 / 3; margin: 0 auto 10px; border-radius: 14px; overflow: hidden; background: #0b1b33; }
.cam-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam-oval { position: absolute; left: 50%; top: 48%; width: 46%; height: 70%; transform: translate(-50%, -50%);
  border: 3px dashed rgba(255, 255, 255, .7); border-radius: 50%; pointer-events: none; }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px; background: rgba(13, 71, 161, .85); color: #fff;
  font-size: 18px; font-weight: 600; text-align: center; display: none; }
.face-login { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.face-login .btn.big { justify-content: center; padding: 11px 16px; font-size: 16px; }
.pin-input { text-align: center; font-size: 22px; letter-spacing: 8px; padding: 8px; }
.pin-input::placeholder { letter-spacing: normal; font-size: 16px; }
.steps { display: flex; justify-content: center; gap: 8px; min-height: 10px; }
.steps i { width: 36px; height: 6px; border-radius: 3px; background: #d9dee7; }
.steps i.cur { background: #ffca28; }
.steps i.done { background: var(--ok); }
.modes { display: grid; gap: 8px; }
.mode { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.mode:has(input:checked) { border-color: var(--primary-2); background: var(--primary-soft); }
.mode input { margin-top: 4px; }
.mode .hint { margin: 2px 0 0; }
.sec-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1f5; }
.sec-row > span { width: 110px; }
.sec-row > b { flex: 1; }.cam-arrow { position: absolute; top: 40%; transform: translateY(-50%); font-size: 64px; line-height: 1; color: #ffca28;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6); pointer-events: none; display: none; }
.cam-arrow.left { display: block; left: 6%; animation: nudge-l .8s ease-in-out infinite; }
.cam-arrow.right { display: block; right: 6%; animation: nudge-r .8s ease-in-out infinite; }
@keyframes nudge-l { 50% { transform: translate(-12px, -50%); } }
@keyframes nudge-r { 50% { transform: translate(12px, -50%); } }
.cam-count { position: absolute; top: 10px; right: 10px; width: 54px; height: 54px; border-radius: 50%; display: none;
  place-items: center; background: rgba(13, 71, 161, .9); color: #fff; font-size: 28px; font-weight: 700; pointer-events: none; }
.face-login .rules { margin: 0; font-size: 12.5px; line-height: 1.5; }
/* ------------------------------------------------ Face ID: рўйхатга олиш ойнаси */
.enroll-msg { display: none; margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; font-weight: 600; line-height: 1.45; }
.enroll-msg.info { background: var(--primary-soft); color: var(--primary); border: 1px solid #b7d3f6; }
.enroll-msg.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2c0; }
.enroll-msg.ok { background: #e8f5e9; color: var(--ok); border: 1px solid #b9e0bb; font-size: 15px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px; background: #f4f6fa; border-radius: 12px; margin-bottom: 10px; }
.thumbs img { height: 150px; max-width: 200px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.enroll-done { position: relative; width: 170px; margin: 6px auto 12px; }
.enroll-done img { width: 170px; height: 170px; object-fit: cover; border-radius: 50%; border: 4px solid var(--ok); display: block; }
.enroll-done .tick { position: absolute; right: 2px; bottom: 6px; width: 44px; height: 44px; border-radius: 50%; background: var(--ok);
  color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 700; border: 3px solid #fff; }
.enroll-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 6px; }

/* ------------------------------------------------ Excel импорт */
.radios { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.dropzone { border: 2px dashed #9ec5f4; border-radius: 12px; padding: 34px 20px; text-align: center; cursor: pointer;
  background: #f6f9fe; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.dropzone.over, .dropzone:hover { background: var(--primary-soft); border-color: var(--primary-2); }
.dropzone .dz-ico { font-size: 40px; margin-bottom: 6px; }
.dropzone .hint { font-weight: 400; }
.imp-files { display: grid; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.imp-file { padding: 6px 10px; border-radius: 6px; background: #f4f6fa; }
.imp-file.bad { background: #fdecea; }
.imp-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.st { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st.st-ok { background: #e8f5e9; color: var(--ok); }
.st.st-warn { background: #fff4e0; color: #b45309; }
.st.st-dup { background: #eceff3; color: #52514e; }
.st.st-err { background: #fdecea; color: var(--danger); }
.imp-table { max-height: 46vh; }
.imp-table tr.st-err td { background: #fff7f6; }
.imp-table tr.st-dup td { color: #8a8a8a; }
.imp-table td.notes { font-size: 12.5px; color: #52514e; max-width: 360px; }
.imp-table tr.st-err td.notes { color: var(--danger); }
.imp-done { text-align: center; padding: 18px 0 8px; }
.imp-done .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 34px;
  display: grid; place-items: center; margin: 0 auto 10px; }
.imp-done .big { font-size: 20px; font-weight: 700; color: var(--ok); margin-bottom: 6px; }
.imp-table td.unote { font-size: 12.5px; max-width: 200px; font-style: italic; }
.modal.wide:has(.imp-table), .modal.wide:has(.dropzone) { width: min(1320px, 100%); }
.imp-table td.notes { min-width: 220px; }

/* ------------------------------------------------ журнал */
.jstats { margin-top: 4px; }
.stat.good .s-value { color: var(--ok); }
.stat.bad .s-value { color: var(--danger); }
.jpanel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.jfilters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.jfilters + .jfilters { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); align-items: center; }
.jfilters label.f { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12.5px; min-width: 200px; }
.jfilters label.f .ssel { flex-direction: row; }
.jfilters label.f .ssel input { width: 110px; }
.jfilters .range { display: flex; align-items: center; gap: 6px; }
.jactions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btn-group.excel { padding: 4px 4px 4px 10px; border: 1px solid #b9e0bb; background: #f3faf3; border-radius: 8px; }
.btn-group .grp-label { color: var(--ok); font-weight: 600; font-size: 13px; }

.catbar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 10px; }
.catchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px;
  background: color-mix(in srgb, var(--c) 12%, white); border: 1px solid color-mix(in srgb, var(--c) 35%, white); color: #1f2933;
  white-space: nowrap; font-family: inherit; }
.catchip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.catchip b { font-weight: 600; color: #52514e; }
button.catchip { cursor: pointer; }
button.catchip:hover { border-color: var(--c); }
button.catchip.active { background: var(--c); border-color: var(--c); color: #fff; }
button.catchip.active i { background: #fff; }
button.catchip.active b { color: #fff; }

.dbadge { display: inline-flex; flex-direction: column; align-items: center; min-width: 50px; padding: 3px 6px; border-radius: 8px;
  background: #eef3fa; border: 1px solid #d6e2f2; line-height: 1.15; }
.dbadge b { font-size: 17px; color: var(--primary); }
.dbadge span { font-size: 11px; color: var(--muted); }
.jperson { display: flex; align-items: center; gap: 9px; min-width: 190px; }
.jperson .nm { font-weight: 600; }
.sub { font-size: 12px; color: var(--muted); line-height: 1.35; }
.jwork { min-width: 240px; }
.jwork .catchip { font-size: 11.5px; padding: 1px 8px 1px 6px; margin-bottom: 3px; }
.jind { font-weight: 500; }
.tag { display: inline-block; margin-top: 3px; padding: 0 7px; border-radius: 6px; background: #f1f1ee; color: #52514e; font-size: 11.5px; }
.jqty b { font-size: 15px; margin-right: 4px; }
.jqty span { color: var(--muted); font-size: 12px; }
.jball b { font-size: 16px; }
.jball.pos b { color: var(--ok); }
.jball.neg b { color: var(--danger); }
.jball .formula { font-size: 11px; color: var(--muted); white-space: nowrap; }
.docno { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #f4f6fa; border: 1px solid var(--border);
  font-family: Consolas, "Courier New", monospace; font-size: 12.5px; white-space: nowrap; }
.jnote { max-width: 240px; font-size: 12.5px; color: #52514e; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jfilters input[type=search] { min-width: 340px; }

/* ------------------------------------------------ KPI ҳисоботлари: баннер */
.rep-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(120deg, #0b2a5b 0%, #0d47a1 55%, #1976d2 100%); color: #fff; border-radius: 14px;
  padding: 20px 26px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(13, 71, 161, .18);
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hero-main { flex: 1; min-width: 300px; }
.hero-kicker { text-transform: uppercase; letter-spacing: 1.2px; font-size: 12px; opacity: .75; font-weight: 600; }
.hero-scope { font-size: 26px; font-weight: 700; margin: 2px 0; }
.hero-period { opacity: .85; margin-bottom: 10px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hero-facts .hf { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); padding: 4px 10px;
  border-radius: 999px; font-size: 13px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero-actions > span { opacity: .8; margin-right: 2px; }
.hero-actions .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: #fff; }
.hero-actions .btn:hover { background: rgba(255, 255, 255, .25); color: #fff; border-color: #fff; }
.hero-gauge { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 210px; }
.hero-gauge .badge { font-size: 13px; padding: 3px 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
svg.gauge .g-track { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 16; stroke-linecap: round; }
svg.gauge .g-val { fill: none; stroke-width: 16; stroke-linecap: round; }
svg.gauge .g-tick { stroke: #fff; stroke-width: 2; }
svg.gauge .g-ticklbl { fill: rgba(255, 255, 255, .8); font-size: 10px; }
svg.gauge .g-num { fill: #fff; font-size: 30px; font-weight: 700; }
svg.gauge .g-lbl { fill: rgba(255, 255, 255, .8); font-size: 12px; }
.rep-filters .seg button { padding: 7px 18px; }
.sec-title { font-size: 17px; margin: 22px 0 10px; color: #1f2933; }

/* карточкалар — белги ва ранг */
.stat { position: relative; }
.stat .s-ico { position: absolute; top: 12px; right: 14px; font-size: 22px; opacity: .85; }
.stat.good { border-color: #b9e0bb; background: linear-gradient(#f3faf3, #fff); }
.stat.good .s-value { color: var(--ok); }
.stat.bad { border-color: #f5c2c0; background: linear-gradient(#fff6f5, #fff); }
.stat.bad .s-value { color: var(--danger); }
.stat.warn { border-color: #f6dca8; background: linear-gradient(#fffaf0, #fff); }
.stat.warn .s-value { color: #b45309; }

/* хулосалар */
.ins-list { list-style: none; margin: 4px 0 6px; padding: 0; display: grid; gap: 6px; }
.ins { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 8px; border-left: 4px solid #9ec5f4;
  background: #f6f9fe; line-height: 1.45; }
.ins .ins-ico { font-size: 16px; line-height: 1.3; }
.ins.good { border-left-color: var(--ok); background: #f3faf3; }
.ins.bad { border-left-color: var(--danger); background: #fff6f5; }
.ins.warn { border-left-color: #eda100; background: #fffaf0; }

/* бўлим карточкалари */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.dept-card { background: var(--panel); border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: 10px; padding: 12px 14px; }
.dc-name { font-weight: 600; min-height: 2.6em; line-height: 1.3; }
.dc-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; }
.dc-kpi { font-size: 26px; font-weight: 700; color: var(--c); }
.dc-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.meter.wide { justify-content: stretch; min-width: 0; }
.meter.wide .track { max-width: none; height: 8px; }
.meter.wide .track span { border-radius: 4px; }

@media print {
  .rep-filters, .hero-actions { display: none !important; }
  .rep-hero { box-shadow: none; }
}

/* ------------------------------------------------ локал тармоқ */
.net-urls { display: grid; gap: 6px; margin: 8px 0; }
.net-url { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.net-url code { font: 600 15px Consolas, "Courier New", monospace; background: #f4f7fc; border: 1px dashed var(--primary-2);
  padding: 6px 10px; border-radius: 6px; user-select: all; word-break: break-all; }
.net-help { margin-top: 10px; }
.net-help summary { cursor: pointer; color: var(--primary-2); }
.topbar .btn.net-chip { background: rgba(46, 125, 50, .9); border-color: rgba(255, 255, 255, .5); font-family: Consolas, monospace; }

/* ------------------------------------------------ вилоят ҳаритаси */
.map-two { grid-template-columns: minmax(0, 554px) minmax(0, 1fr); align-items: start; }
.regionmap { display: block; margin: 0 auto; }
.regionmap .region { transition: filter .12s; }
.regionmap .region:hover { stroke: #0b0b0b; stroke-width: 2; filter: brightness(1.06); }
.regionmap .region.pick { cursor: pointer; }
.regionmap .mlbl { font-size: 11.5px; font-weight: 600; }
.regionmap .mval { font-size: 12.5px; font-weight: 700; }
.regionmap .lgd { font-size: 11.5px; fill: #52514e; }
.mrank { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: mr; }
.mrank li { display: grid; grid-template-columns: 22px 12px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 7px 6px; border-bottom: 1px solid var(--border); counter-increment: mr; border-radius: 6px; }
.mrank li::before { content: counter(mr); color: var(--muted); font-size: 12px; text-align: right; }
.mrank li.pick { cursor: pointer; }
.mrank li.pick:hover { background: #f4f7fc; }
.mrank i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mrank .mr-name { min-width: 0; overflow: hidden; }
.mrank .mr-name small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrank b { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .map-two { grid-template-columns: 1fr; } }

.face-pin { display: grid; gap: 8px; justify-items: center; margin: 6px 0; }
.face-pin .sub { margin: 0; }

/* ------------------------------------------------ KPI ўзгариши омиллари */
.factors-sec { margin-top: 6px; }
.fx-panel { margin-bottom: 14px; }
.fx-head { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; }
.fx-kpi { display: grid; justify-items: center; gap: 2px; }
.fx-kpi b { font-size: 26px; font-variant-numeric: tabular-nums; }
.fx-arrow { font-size: 18px; font-weight: 700; padding: 6px 14px; border-radius: 999px; background: #eef1f5; }
.fx-arrow.bad { color: #b71c1c; background: #fdecea; }
.fx-arrow.good { color: #1b5e20; background: #e8f5e9; }
.ok-text { color: #2e7d32; }

/* ------------------------------------------------ ходим ойнаси */
.modal.wide:has(.ep) { width: min(1040px, 100%); }
.ep { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.ep-card { position: sticky; top: 0; display: grid; justify-items: center; gap: 8px; text-align: center; padding: 22px 16px;
  border-radius: 14px; background: linear-gradient(160deg, #0d47a1 0%, #1565c0 55%, #1e88e5 100%); color: #fff; }
.ep-photo-wrap { display: grid; justify-items: center; gap: 4px; }
.ep-photo { position: relative; width: 132px; height: 132px; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 4px rgba(255,255,255,.35);
  transition: box-shadow .15s, transform .15s; }
.ep-photo:hover, .ep-photo.drag { box-shadow: 0 0 0 4px #fff; transform: scale(1.02); }
.ep-photo .ava { width: 132px; height: 132px; font-size: 44px; }
.ep-photo .ava.ini { background: rgba(255,255,255,.18); color: #fff; }
.ep-cam { position: absolute; right: 2px; bottom: 6px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #0d47a1; font-size: 17px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.ep-card .btn.link { color: #dbe8ff; font-size: 12.5px; }
.ep-name { font-size: 19px; font-weight: 700; line-height: 1.25; word-break: break-word; margin-top: 4px; }
.ep-name.ph { color: rgba(255,255,255,.72); font-weight: 600; }
.ep-pos { font-size: 13px; color: #dbe8ff; }
.ep-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.ep-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.16); white-space: nowrap; }
.ep-chip.own { background: #fff3c4; color: #6d4c00; font-weight: 600; }
.ep-status { margin-top: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 12px; border-radius: 999px; }
.ep-status.on { background: #e8f5e9; color: #1b5e20; }
.ep-status.off { background: #eceff1; color: #546e7a; }
.ep-form { display: grid; gap: 12px; }
.ep-sec { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; background: #fbfcfe; display: grid; gap: 10px; }
.ep-sec h4 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; color: var(--primary); }
.ep-sec h4 i { font-style: normal; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--primary-soft); }
.ep-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.ep-f { display: grid; gap: 4px; align-content: start; min-width: 0; }
.ep-f > span { font-size: 12.5px; color: var(--muted); }
.ep-f.req > span::after { content: " *"; color: var(--danger); }
.ep-f.wide { grid-column: 1 / -1; }
.ep-f small { color: var(--muted); font-size: 11.5px; }
.ep-f input, .ep-f textarea, .ep-f select, .ep-norm input[type=number] { width: 100%; box-sizing: border-box; }
.ep input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(198,40,40,.12); }
.ep-warn { color: var(--warn); font-size: 12.5px; min-height: 0; }
.ep-warn:empty { display: none; }
.ep-norm { display: grid; grid-template-columns: 1fr auto 140px; gap: 12px; align-items: center; }
.ep-norm-info { font-weight: 600; color: var(--primary-2); }
.ep-norm input:disabled { opacity: .45; }
.ep-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; }
.ep-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ep-switch .sw { width: 38px; height: 22px; border-radius: 999px; background: #c5ccd6; position: relative; transition: background .15s; flex: none; }
.ep-switch .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.ep-switch input:checked + .sw { background: var(--ok); }
.ep-switch input:checked + .sw::after { transform: translateX(16px); }
.ep-switch input:focus-visible + .sw { outline: 2px solid var(--primary-2); outline-offset: 2px; }
@media (max-width: 860px) { .ep { grid-template-columns: 1fr; } .ep-card { position: static; } .ep-grid { grid-template-columns: 1fr 1fr; } .ep-norm { grid-template-columns: 1fr; } }

/* ------------------------------------------------ босиладиган кўрсаткичлар */
.stat.link, .dept-card.link, .hf.link, .card.link { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stat.link:hover, .dept-card.link:hover, .card.link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(13,71,161,.14); }
.stat.link::after { content: "↗"; position: absolute; right: 10px; bottom: 8px; font-size: 13px; color: var(--primary-2); opacity: .55; }
.stat.link { position: relative; }
.hf.link:hover { background: rgba(255,255,255,.28); }
.chart .hit.click { cursor: pointer; }
.chart .hit.click:hover { fill: rgba(21,101,192,.06); }
.drill-sub { margin: 0 0 10px; color: var(--muted); }
.modal.wide:has(.drill) { width: min(1280px, 100%); }

/* ------------------------------------------------ бажарилган иш ойнаси */
.modal.wide:has(.jd) { width: min(1180px, 100%); }
.jd { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.jd-main { display: grid; gap: 12px; min-width: 0; }
.jd-step { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; background: #fbfcfe; display: grid; gap: 10px; }
.jd-step h4 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--primary); }
.jd-step h4 i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 13px; }
.jd-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.jd-f { display: grid; gap: 4px; min-width: 0; }
.jd-f.grow { flex: 1 1 260px; }
.jd-f > span { font-size: 12.5px; color: var(--muted); }
.jd-f > span.req-on { color: var(--danger); font-weight: 600; }
.jd-date { display: flex; gap: 6px; align-items: center; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.jd-emp { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--primary-soft); }
.jd-emp .nm { font-weight: 600; }
.jd-emp .sub { font-size: 12.5px; color: var(--muted); }
.jd-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.jd-inds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.jd-ind { text-align: left; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--primary-2)); border-radius: 10px; background: #fff;
  padding: 9px 11px; cursor: pointer; display: grid; gap: 5px; font: inherit; color: inherit; transition: box-shadow .12s, transform .12s; }
.jd-ind:hover { box-shadow: 0 4px 12px rgba(13,71,161,.12); transform: translateY(-1px); }
.jd-ind.on { background: #eaf2fe; border-color: var(--primary-2); box-shadow: 0 0 0 2px var(--primary-2) inset; }
.jd-ind .n { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.jd-ind .m { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.jd-ind .m b { color: var(--ok); font-size: 12.5px; }
.jd-ind.neg .m b { color: var(--danger); }
.jd-ind .m .c { color: var(--c); font-weight: 600; }
.jd-ind .m .req { color: var(--warn); font-weight: 600; }
.jd-empty { color: var(--warn); font-size: 13px; }
.jd-empty:empty { display: none; }
.jd-stepper { display: flex; align-items: center; gap: 6px; }
.jd-stepper .btn { width: 36px; padding: 6px 0; font-size: 17px; font-weight: 700; }
.jd-qty { width: 90px; text-align: center; font-size: 16px; font-weight: 700; }
.jd-unit { color: var(--muted); min-width: 40px; }
.jd-cmp { flex-wrap: wrap; }
.jd-sum { position: sticky; top: 0; border-radius: 14px; padding: 16px; display: grid; gap: 10px; color: #fff;
  background: linear-gradient(160deg, #0d47a1 0%, #1565c0 60%, #1e88e5 100%); }
.jd-sum-t { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.jd-sum-ind { font-weight: 600; line-height: 1.3; }
.jd-ball { font-size: 34px; font-weight: 800; line-height: 1; }
.jd-ball.neg { color: #ffcdd2; }
.jd-formula { display: grid; gap: 3px; font-size: 13px; background: rgba(255,255,255,.12); border-radius: 10px; padding: 8px 10px; }
.jd-formula:empty { display: none; }
.jd-formula div { display: flex; justify-content: space-between; gap: 8px; }
.jd-formula span { opacity: .85; }
.jd-formula .tot { border-top: 1px solid rgba(255,255,255,.3); padding-top: 4px; margin-top: 2px; font-size: 14px; }
.jd-warn { display: grid; gap: 4px; font-size: 12.5px; }
.jd-warn div { background: #fff3c4; color: #6d4c00; border-radius: 8px; padding: 6px 8px; }
.jd-warn:empty { display: none; }
.jd-month { display: grid; gap: 4px; background: #fff; color: var(--text); border-radius: 10px; padding: 10px; font-size: 13px; }
.jd-month:empty { display: none; }
.jd-mt { font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.jd-mrow { display: flex; justify-content: space-between; }
.jd-mrow span { color: var(--muted); }
.jd-progress .bar { height: 8px; border-radius: 4px; background: #e3edfb; display: flex; overflow: hidden; margin: 6px 0 4px; }
.jd-progress .bar i { display: block; height: 100%; background: var(--primary-2); }
.jd-progress .bar i.add { background: var(--ok); }
.jd-pct { font-size: 12.5px; color: var(--muted); }
.jd-pct b { color: var(--ok); }
.jd-meta { font-size: 11.5px; opacity: .8; }
@media (max-width: 900px) { .jd { grid-template-columns: 1fr; } .jd-sum { position: static; } }

.fx-cmp { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; margin: 4px 0 12px; }
.fx-box { display: grid; justify-items: center; gap: 2px; padding: 10px 18px; border: 1px solid var(--border); border-radius: 12px; min-width: 190px; background: #fbfcfe; }
.fx-box span { font-weight: 600; color: var(--primary); }
.fx-box small { color: var(--muted); }
.fx-box b { font-size: 22px; }
.fx-box em { font-style: normal; color: var(--muted); font-size: 12.5px; }
.fx-verdict { margin-bottom: 10px; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; }

/* ------------------------------------------------ синов маълумотлари */
.td-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.td-row { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fbfcfe; }
.td-row span { color: var(--muted); font-size: 12.5px; }
.td-row b { font-size: 22px; }
.td-row em { font-style: normal; font-size: 12px; color: var(--warn); min-height: 14px; }
.td-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.td-confirm { margin-top: 6px; }
.td-confirm input { width: 220px; font-weight: 700; letter-spacing: .05em; }
