:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --ink: #1b2433;
  --muted: #667085;
  --line: #e3e8ef;
  --side: #14305a;
  --side-2: #1b3d70;
  --side-ink: #c9d6ea;
  --pri: #1f6feb;
  --pri-soft: #e8f0fe;
  --ok: #12805c;
  --ok-soft: #e3f5ee;
  --warn: #b25e09;
  --warn-soft: #fdf1e2;
  --bad: #c4312b;
  --bad-soft: #fdeceb;
  --violet: #6a4bd6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 60px 1fr; min-height: 100vh; }
.header {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.brand img { width: 36px; height: 36px; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand span { display: block; font-size: 11.5px; color: var(--muted); }
.header .spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.bell { position: relative; background: none; border: 1px solid var(--line); border-radius: 50%; width: 38px; height: 38px; cursor: pointer; font-size: 17px; }
.bell .dot { position: absolute; top: -3px; right: -3px; background: var(--bad); color: #fff; font-size: 10.5px; border-radius: 10px; padding: 1px 5px; font-weight: 600; }
.profile { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.profile:hover { background: var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pri-soft); color: var(--pri); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile .who { line-height: 1.2; }
.profile .who small { color: var(--muted); display: block; font-size: 11.5px; }

.sidebar { background: var(--side); color: var(--side-ink); padding: 14px 10px; overflow-y: auto; }
.nav a, .nav .grp {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--side-ink);
  text-decoration: none; margin-bottom: 2px; font-size: 13.5px;
}
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: var(--pri); color: #fff; }
.nav .ico { width: 20px; text-align: center; }
.nav .grp { cursor: default; color: #fff; font-weight: 600; margin-top: 4px; }
.nav .sub a { padding-left: 42px; font-size: 13px; }
.nav .badge { margin-left: auto; background: #f5a524; color: #1b2433; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 10px 4px; }
.side-foot { font-size: 11px; color: #8ea3c4; padding: 12px; }

.main { padding: 22px 24px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }

.stat { padding: 16px; display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; flex: none; }
.stat .v { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.c-blue .ic { background: var(--pri-soft); }
.c-green .ic { background: var(--ok-soft); }
.c-violet .ic { background: #efeafd; }
.c-amber .ic { background: var(--warn-soft); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.pri:hover { background: #185cc7; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.warn { background: #e58a14; border-color: #e58a14; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; background: #f8fafc; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fafbfd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.title { max-width: 420px; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tag.pending { background: var(--warn-soft); color: var(--warn); }
.tag.approved { background: var(--ok-soft); color: var(--ok); }
.tag.rejected { background: var(--bad-soft); color: var(--bad); }
.tag.revision { background: #efeafd; color: var(--violet); }
.tag.blue { background: var(--pri-soft); color: var(--pri); }
.tag.gold { background: #fff4d6; color: #8a6100; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.input, select.input, textarea.input {
  border: 1px solid #cfd6e1; border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0;
}
.input:focus { border-color: var(--pri); outline: none; box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.filters .input { min-width: 160px; }
.form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field label .req { color: var(--bad); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .input { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.drop {
  border: 2px dashed #b9c6da; border-radius: 10px; padding: 18px; text-align: center; background: #f8fafc; cursor: pointer;
}
.drop.has { border-color: var(--ok); background: var(--ok-soft); }
.scan-note { margin-top: 8px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--pri-soft); color: #174ea6; }

/* bar chart */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 10px; align-items: center; }
.bar-row .name { font-size: 12.5px; line-height: 1.25; }
.bar-stack { display: grid; gap: 3px; }
.bar { height: 10px; border-radius: 5px; min-width: 2px; }
.bar.b1 { background: var(--pri); }
.bar.b2 { background: #f5a524; }
.bar.b3 { background: #19a974; }
.bar-val { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.cols .col b { width: 100%; max-width: 28px; background: var(--pri); border-radius: 4px 4px 0 0; min-height: 2px; }
.cols .col span { font-size: 10.5px; color: var(--muted); }

.list-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal-h { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-b { padding: 18px; }
.modal-f { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

.toast { position: fixed; bottom: 20px; right: 20px; background: #1b2433; color: #fff; padding: 12px 16px; border-radius: 10px; z-index: 60; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.err { background: var(--bad); }

.notif-panel { position: absolute; top: 56px; right: 20px; width: 360px; max-height: 460px; overflow: auto; z-index: 30; }
.notif { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.notif.unread { background: #f4f8ff; }
.notif small { color: var(--muted); display: block; margin-top: 3px; }

.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #f0f0f0; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.plag { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.plag.low { background: var(--ok-soft); color: var(--ok); }
.plag.mid { background: var(--warn-soft); color: var(--warn); }
.plag.high { background: var(--bad-soft); color: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.tabs button.on { color: var(--pri); border-bottom-color: var(--pri); }

.qr-box { text-align: center; }
.qr-box img { width: 300px; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
.qr-box .timer { font-size: 22px; font-weight: 700; margin-top: 8px; font-variant-numeric: tabular-nums; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }

.rank { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); font-weight: 700; font-size: 12.5px; }
.rank.r1 { background: #ffd666; }
.rank.r2 { background: #d9dee7; }
.rank.r3 { background: #f1c09a; }
.kpi-big { font-size: 38px; font-weight: 800; color: var(--pri); line-height: 1; }
.progress { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(160deg, #14305a 0%, #1f4e8c 60%, #2a6fcf 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 30px; margin: 22px 0 10px; }
.login-art p { color: #d3e0f5; max-width: 460px; line-height: 1.55; }
.login-art ul { padding: 0; list-style: none; display: grid; gap: 10px; color: #e6eefb; max-width: 460px; }
.login-art li::before { content: "✓"; margin-right: 10px; color: #7fd1a8; font-weight: 700; }
.login-form { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(400px, 100%); }
.login-card .tabs { margin-bottom: 20px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .review-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 60px; left: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-block; }
  .brand { min-width: 0; }
  .brand span, .profile .who { display: none; }
  .main { padding: 16px; }
  .g3, .g2, .row2 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 28px 16px; }
  .notif-panel { right: 8px; left: 8px; width: auto; }
  .kv { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr; }
  .filters .input { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* talaba tanlash (hemis-baza qidiruvi) */
.st-picker { position: relative; }
.st-results { position: absolute; left: 0; right: 0; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(16,24,40,.12); max-height: 280px; overflow: auto; margin-top: 4px; }
.st-opt { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line); padding: 8px 12px; cursor: pointer; }
.st-opt:last-child { border-bottom: none; }
.st-opt:hover, .st-opt:focus { background: var(--pri-soft); }
.st-opt .small { display: block; margin-top: 2px; }
.st-chosen { padding: 8px 10px; border-radius: 8px; background: var(--ok-soft); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
