:root {
  --blue-900: #0b2a6b;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7fc;
  --card: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(29, 78, 216, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.topbar {
  background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.topbar .sub { font-size: 12px; opacity: .8; }
.topbar a, .topbar button.link { color: #fff; font-size: 14px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1200px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }

label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit;
  padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--blue-100); border-color: var(--blue-500); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--blue-600); color: #fff; text-decoration: none;
  min-height: 46px;
}
.btn:hover { background: var(--blue-700); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 16px; }
.btn.ghost { background: #fff; color: var(--blue-700); border-color: #bfdbfe; }
.btn.ghost:hover { background: var(--blue-50); }
.btn.small { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.btn.danger { background: #fff; color: var(--bad); border-color: #fecaca; }
button.link { background: none; border: 0; color: var(--blue-700); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.msg { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 12px; }
.msg.err { background: var(--bad-bg); color: var(--bad); }
.msg.ok  { background: var(--ok-bg); color: var(--ok); }
.msg.info { background: var(--blue-50); color: var(--blue-900); }

/* ---------- Ажилтны тест ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--blue-700); }
.stat span { font-size: 12px; color: var(--muted); }

.progress { display: flex; gap: 6px; margin-bottom: 12px; }
.progress i { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.progress i.done-ok { background: var(--ok); }
.progress i.done-bad { background: var(--bad); }
.progress i.current { background: var(--blue-500); }

.qmeta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.qtext { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  width: 100%; font: inherit; cursor: pointer;
  padding: 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.opt:hover:not(:disabled) { border-color: var(--blue-500); background: var(--blue-50); }
.opt .key {
  flex: 0 0 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue-100); color: var(--blue-900); font-weight: 700; font-size: 14px;
}
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; }

.feedback { margin-top: 16px; border-radius: 12px; padding: 14px; }
.feedback.ok { background: var(--ok-bg); }
.feedback.bad { background: var(--bad-bg); }
.feedback h3 { margin: 0 0 6px; font-size: 16px; }
.feedback .ref { margin-top: 10px; font-size: 14px; }
.quote {
  margin: 8px 0 0; padding: 10px 12px; border-left: 4px solid var(--blue-500);
  background: #fff; border-radius: 0 8px 8px 0; font-size: 14px; color: #334155;
}

.done-hero { text-align: center; padding: 26px 18px; }
.done-hero .big { font-size: 44px; font-weight: 800; color: var(--blue-700); }

/* ---------- Админ ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs button {
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  padding: 9px 14px; border-radius: 999px; border: 1px solid #bfdbfe; background: #fff; color: var(--blue-700);
}
.tabs button.active { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.toolbar > div { min-width: 140px; }
.toolbar label { margin-top: 0; }
.toolbar input, .toolbar select { padding: 9px 10px; }
.toolbar .btn { min-height: 42px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font-size: 26px; color: var(--blue-900); }
.kpi span { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--blue-50); color: var(--blue-900); font-weight: 650; position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.gray { background: #f1f5f9; color: var(--muted); }

dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(720px, 96vw); max-height: 92vh;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .3);
}
dialog::backdrop { background: rgba(11, 42, 107, .35); }
dialog form { padding: 18px; }
dialog h3 { margin: 0 0 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .qtext { font-size: 17px; }
}

/* ---------- Апп суулгах ---------- */
.install { border-color: #bfdbfe; background: linear-gradient(135deg, #eff6ff, #ffffff); }
.install-row { display: flex; gap: 12px; align-items: center; }
.install-row img { border-radius: 12px; }
.install-actions { display: flex; gap: 8px; margin-top: 12px; }
.install-actions .btn { flex: 1; min-height: 42px; }
.ios-steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.ios-steps li { margin: 3px 0; }
@media (display-mode: standalone) {
  .topbar { padding-top: max(14px, env(safe-area-inset-top)); }
}

/* ---------- Профайл, од ---------- */
.profile { padding: 14px 16px; }
.profile-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stars { font-size: 28px; color: #f59e0b; letter-spacing: 2px; line-height: 1.1; }
.stars.empty { color: #cbd5e1; }
.next-star { text-align: right; font-size: 13px; line-height: 1.3; }
.next-star b { font-size: 22px; color: var(--blue-700); }
.star-bar { height: 8px; background: var(--blue-50); border-radius: 8px; overflow: hidden; margin: 10px 0 12px; }
.star-bar i { display: block; height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b); border-radius: 8px; transition: width .4s; }
.profile .stats { margin-bottom: 0; }
.star-toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 100;
  background: #fff; border: 2px solid #fbbf24; border-radius: 18px; padding: 18px 26px; text-align: center;
  box-shadow: 0 20px 50px rgba(11, 42, 107, .25); font-size: 15px; animation: pop .35s ease-out;
}
.star-toast:first-line { font-size: 46px; color: #f59e0b; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* ---------- Нэмэлт дадлага ---------- */
.practice-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.practice-actions { display: flex; gap: 8px; margin-top: 14px; }
.practice-actions select { flex: 1; padding: 9px 10px; }
.practice-actions .btn { min-height: 42px; }
.quote.clamp { max-height: 9.5em; overflow: hidden; position: relative; }
.quote.clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5em; background: linear-gradient(transparent, #fff); }
.feedback .more { margin-top: 6px; font-size: 14px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: var(--blue-100); }
th.sortable .arr { opacity: .5; font-size: 11px; }
.clause-preview { margin-top: 6px; padding: 8px 10px; background: var(--blue-50); border-radius: 8px; font-size: 13px; color: #334155; max-height: 140px; overflow: auto; white-space: pre-line; }

/* ---------- v3: өдрийн явц, зааварчилгаа ---------- */
.daytrack { display: flex; gap: 6px; margin: 0 0 12px; }
.daytrack .step { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.daytrack .step i { flex: 0 0 18px; height: 18px; border-radius: 50%; border: 2px solid #cbd5e1; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 800; }
.daytrack .step.ok { color: var(--ok); background: var(--ok-bg); border-color: #bbf7d0; }
.daytrack .step.ok i { background: var(--ok); border-color: var(--ok); color: #fff; }
.locked { display: flex; gap: 12px; align-items: center; }
.locked .lock { font-size: 26px; }
.score-banner { background: var(--blue-50); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }
.pick-tools { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0; }
@media (min-width: 560px) { .pick-tools { grid-template-columns: 1fr 200px; } }
.pick-tools input, .pick-tools select { padding: 10px 12px; }
.ilist { display: grid; gap: 8px; }
.iitem { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; margin: 0; font-weight: 400; }
.iitem.on { border-color: var(--blue-500); background: var(--blue-50); }
.iitem.row { cursor: default; }
.iitem input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--blue-600); }
.iitem .ibody { flex: 1; min-width: 0; }
.iitem .ibody b { display: block; font-size: 15px; line-height: 1.35; }
.ftype { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.ftype.pdf { background: #fee2e2; color: #b91c1c; }
.ftype.docx, .ftype.doc { background: #dbeafe; color: #1d4ed8; }
.pick-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; padding: 12px 0 2px; margin-top: 10px; border-top: 1px solid var(--line); }
.instr-progress { margin: 6px 0 4px; }
.instr-progress .star-bar i { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.done-instr { background: var(--ok-bg); color: var(--ok); font-weight: 700; text-align: center; border-radius: 12px; padding: 14px; font-size: 17px; margin-bottom: 12px; }
.grid-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.sub-h { font-size: 15px; margin: 16px 0 8px; }
.retake-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.retake-stats div { background: var(--blue-50); border-radius: 10px; padding: 8px; }
.retake-stats b { display: block; font-size: 20px; color: var(--blue-900); }
.retake-stats span { font-size: 12px; color: var(--muted); }

/* Унших цонх */
body.noscroll { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 50; background: #f1f5f9; display: flex; flex-direction: column; }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: linear-gradient(135deg, var(--blue-900), var(--blue-700)); color: #fff; }
.viewer-head .muted { color: #cbd5e1; font-size: 12px; }
.viewer-title { flex: 1; min-width: 0; }
.viewer-title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-close { background: rgba(255,255,255,.15); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 10px; font-size: 18px; cursor: pointer; }
.viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px; }
.viewer-foot { background: #fff; border-top: 1px solid var(--line); padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom)); text-align: center; }
.viewer-foot .btn.block { margin-top: 6px; }
.doc-body { background: #fff; max-width: 820px; margin: 0 auto; padding: 18px; border-radius: 12px; line-height: 1.6; font-size: 16px; overflow-wrap: anywhere; }
.doc-body img { max-width: 100%; height: auto; }
.doc-body table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.doc-body td, .doc-body th { border: 1px solid var(--line); padding: 4px 6px; }
.pdf-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pdf-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; max-width: 100%; }
.pdf-page canvas { display: block; max-width: 100%; height: auto !important; }
.doc-end { text-align: center; color: var(--muted); padding: 22px 0 30px; font-size: 13px; }

/* Админ: файл оруулах */
.dropzone { border: 2px dashed #93c5fd; border-radius: 14px; padding: 22px; text-align: center; background: var(--blue-50); color: var(--blue-900); cursor: pointer; }
.dropzone.drag { background: var(--blue-100); }
.upl-list { margin-top: 10px; display: grid; gap: 6px; font-size: 14px; }
.upl-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid #bfdbfe; font-size: 13px; }
.chip button { border: 0; background: none; color: var(--bad); cursor: pointer; font-size: 14px; padding: 0; }
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.subtabs button.active { background: var(--blue-50); border-color: var(--blue-500); color: var(--blue-900); font-weight: 600; }

/* ---------------- Таны сонорт (зар, мэдээлэл) ---------------- */
.news { margin-bottom: 16px; }
.news-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
.news-head h2 { margin: 0; font-size: 17px; color: var(--blue-900); display: flex; align-items: center; gap: 8px; }
.news-count { background: var(--blue-100); color: var(--blue-700); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.news-list { display: grid; gap: 10px; }
.news-more { margin-top: 10px; width: 100%; }
.ann {
  --c: var(--blue-700); --c-bg: var(--blue-50); --c-line: #bfdbfe;
  position: relative; background: var(--card); border: 1px solid var(--c-line); border-left: 5px solid var(--c);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); overflow-wrap: anywhere;
  animation: annIn .25s ease-out;
}
.ann-notice  { --c: #15803d; --c-bg: #dcfce7; --c-line: #bbf7d0; }
.ann-warning { --c: #c2410c; --c-bg: #ffedd5; --c-line: #fed7aa; background: #fffaf5; }
.ann-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-right: 26px; }
.ann-tag { background: var(--c-bg); color: var(--c); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.ann-pin { font-size: 12px; color: var(--blue-900); font-weight: 600; }
.ann-new { background: #ef4444; color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; letter-spacing: .2px; }
.ann-date { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.ann-title { margin: 8px 0 4px; font-size: 16px; line-height: 1.35; color: var(--ink); }
.ann-body { margin: 0; color: #334155; font-size: 14.5px; line-height: 1.55; white-space: pre-line; }
.ann-img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-top: 10px; background: var(--c-bg); }
.ann-link { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 14px; color: var(--c); text-decoration: none; }
.ann-link:hover { text-decoration: underline; }
.ann-x {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.ann-x:hover { background: #f1f5f9; color: var(--ink); }
@keyframes annIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* skeleton */
.ann-skel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.sk { border-radius: 6px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: sk 1.2s infinite linear; height: 12px; margin: 6px 0; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Админ: зарын жагсаалт, маягт */
.ann-admin-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .ann-admin-grid { grid-template-columns: 1.1fr 1fr; } }
.ann-preview { background: var(--bg); border: 1px dashed #bfdbfe; border-radius: var(--radius); padding: 12px; }
.ann-preview .muted { font-size: 12px; margin-bottom: 8px; }
.counter { float: right; font-size: 12px; color: var(--muted); }
.counter.over { color: var(--bad); font-weight: 700; }
.pill.info { background: var(--blue-100); color: var(--blue-700); }
.ann-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.ann-actions .btn { padding: 5px 9px; font-size: 13px; }
dialog.wide { width: min(980px, 96vw); }

/* Ажилтан удирдах: бөөнөөр сонгох, импортын урьдчилан харах */
.bulk-bar { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-top: 4px; }
.bulk-bar .btn { margin: 0; }
#empTable tr.sel td { background: #fff7ed; }
#impTable td, #impTable th { white-space: nowrap; }
#impStats .chip b { margin-left: 4px; }

/* ---------------- Safety point ---------------- */
.sp-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sp-main { display: flex; flex-direction: column; gap: 2px; }
.sp-line { display: flex; align-items: center; gap: 6px; line-height: 1; }
.sp-ico { width: 20px; height: 20px; flex: none; color: var(--blue-700); }
.sp-label { font-size: 13px; color: var(--muted); }
.sp-shield { display: inline-flex; align-items: center; justify-content: center; }
.sp-shield.big { font-size: 34px; width: 54px; height: 54px; border-radius: 16px; background: var(--blue-50); border: 1px solid var(--blue-100); }
.sp-total { font-size: 22px; font-weight: 700; color: var(--blue-900); line-height: 1; }
.sp-unit { font-weight: 800; color: var(--blue-700); }
.sp-sub { display: flex; gap: 8px; }
.sp-sub div { background: var(--blue-50); border-radius: 10px; padding: 4px 10px; text-align: center; min-width: 64px; }
.sp-sub b { display: block; font-size: 15px; font-weight: 700; color: var(--blue-900); }
.sp-sub span { font-size: 11.5px; color: var(--muted); }
.sp-hint { margin: 6px 0 10px; font-size: 12px; color: var(--muted); }
.sp-toast {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, 0); z-index: 9999; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-600)); color: #fff; padding: 14px 22px; border-radius: 999px;
  box-shadow: 0 12px 32px rgba(29, 78, 216, .35); font-size: 18px; animation: spPop 2.6s ease forwards; pointer-events: none;
}
.sp-toast .sp-shield { font-size: 26px; animation: spSpin .7s ease; }
@keyframes spPop { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -40px); } }
@keyframes spSpin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }

/* ---------------- Аюул мэдээлэх ---------------- */
:root { --hz: #dc2626; --hz-dark: #b91c1c; --hz-bg: #fef2f2; }
.haz-entry { display: grid; gap: 8px; margin-bottom: 16px; }
.haz-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--hz), var(--hz-dark)); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(220, 38, 38, .28); font: inherit;
}
.haz-btn:active { transform: scale(.99); }
.haz-ico { font-size: 28px; width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.18); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.haz-btn b { display: block; font-size: 18px; }
.haz-btn small { display: block; opacity: .9; font-size: 12.5px; margin-top: 2px; }
.haz-mine { background: #fff; border: 1px solid #fecaca; color: var(--hz-dark); border-radius: 12px; padding: 9px 12px; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.haz-badge { display: inline-block; background: var(--hz); color: #fff; border-radius: 999px; font-size: 11.5px; padding: 1px 8px; margin-left: 6px; }
.haz-badge.q { background: #f59e0b; }
body.no-scroll { overflow: hidden; }
.hz-view { position: fixed; inset: 0; z-index: 900; background: #f6f7f9; display: flex; flex-direction: column; }
.hz-head {
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; background: var(--hz); color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 6px 10px; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.hz-icon { position: relative; background: none; border: 0; color: #fff; font-size: 22px; height: 42px; cursor: pointer; border-radius: 10px; }
.hz-icon:hover { background: rgba(255,255,255,.12); }
.hz-dot { position: absolute; top: 6px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: #fde047; border: 2px solid var(--hz); }
.hz-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 18px; }
.hz-help { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: none; color: #fff; font-weight: 800; font-size: 12px; cursor: pointer; padding: 0; }
.hz-body { flex: 1; overflow-y: auto; padding: 12px 12px calc(env(safe-area-inset-bottom) + 24px); max-width: 640px; width: 100%; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.hz-card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.06); border: 1.5px solid transparent; scroll-margin: 80px; }
.hz-card.bad { border-color: var(--hz); background: #fffafa; }
.hz-label { font-weight: 800; margin-bottom: 10px; color: #111827; }
.hz-label i { color: var(--hz); font-style: normal; }
.hz-sub { color: var(--muted); font-weight: 600; font-size: 13px; }
.hz-err { color: var(--hz); font-size: 13px; font-weight: 600; margin-top: 6px; }
.hz-err:empty { display: none; }
.hz-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hz-chip { border: 1.5px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.hz-chip.on { border-color: var(--hz); background: var(--hz-bg); color: var(--hz-dark); font-weight: 700; }
.hz-card textarea, .hz-card input:not([type=checkbox]):not([type=radio]) { width: 100%; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; background: #fff; }
.hz-card textarea:focus, .hz-card input:focus { outline: none; border-color: var(--hz); }
.hz-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }
.hz-risks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hz-risk { border: 2px solid #e5e7eb; background: #fff; border-radius: 12px; padding: 12px 6px; font: inherit; font-weight: 800; cursor: pointer; }
.hz-risk.r-low { color: #15803d; } .hz-risk.r-medium { color: #b45309; } .hz-risk.r-high { color: var(--hz-dark); }
.hz-risk.r-low.on { background: #16a34a; border-color: #16a34a; color: #fff; }
.hz-risk.r-medium.on { background: #eab308; border-color: #eab308; color: #422006; }
.hz-risk.r-high.on { background: var(--hz); border-color: var(--hz); color: #fff; }
.hz-warn { margin-top: 10px; background: var(--hz-bg); color: var(--hz-dark); border-radius: 10px; padding: 10px 12px; font-weight: 700; font-size: 14px; }
.hz-radio { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 15px; cursor: pointer; }
.hz-radio input { width: 20px; height: 20px; accent-color: var(--hz); }
.hz-note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.hz-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hz-dash { border: 2px dashed #cbd5e1; background: #f8fafc; border-radius: 12px; padding: 16px 6px; font: inherit; font-size: 24px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hz-dash span { font-size: 14px; font-weight: 700; color: #334155; }
.hz-dash:active { background: var(--hz-bg); border-color: var(--hz); }
.hz-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hz-thumbs:empty { display: none; }
.hz-thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: #e5e7eb; display: block; }
.hz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hz-thumb button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.hz-thumb em { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(21,128,61,.85); color: #fff; font-size: 10px; font-style: normal; text-align: center; padding: 1px; }
.hz-thumbs.small .hz-thumb { width: 58px; height: 58px; }
.hz-gps { display: flex; gap: 8px; }
.hz-gps input { flex: 1; }
.hz-gps-btn { flex: none; border: 0; border-radius: 10px; background: #16a34a; color: #fff; font: inherit; font-weight: 800; padding: 0 14px; cursor: pointer; }
.hz-small { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 6px; color: #334155; }
.hz-anon { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hz-switch { position: relative; width: 50px; height: 30px; flex: none; }
.hz-switch input { opacity: 0; width: 0; height: 0; }
.hz-switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: .2s; cursor: pointer; }
.hz-switch span::after { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.hz-switch input:checked + span { background: var(--hz); }
.hz-switch input:checked + span::after { transform: translateX(20px); }
.hz-submit { width: 100%; border: 0; border-radius: 14px; background: var(--hz); color: #fff; font: inherit; font-size: 18px; font-weight: 800; padding: 16px; margin-top: 6px; cursor: pointer; box-shadow: 0 6px 16px rgba(220,38,38,.3); }
.hz-submit:disabled { opacity: .7; }
.hz-done { background: #fff; border-radius: 16px; padding: 28px 18px; text-align: center; margin-top: 20px; }
.hz-done-ico { width: 72px; height: 72px; border-radius: 50%; background: #dcfce7; color: #15803d; font-size: 40px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.hz-done-ico.q { background: #fef3c7; color: #b45309; }
.hz-no { font-size: 20px; }
.hz-item { background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; border-left: 4px solid #cbd5e1; }
.hz-item.unseen { border-left-color: var(--hz); box-shadow: 0 0 0 2px #fecaca; }
.hz-item.queued { border-left-color: #f59e0b; background: #fffbeb; }
.hz-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hz-item-type { font-size: 13px; color: #334155; margin: 4px 0; }
.hz-item p { margin: 6px 0; font-size: 14.5px; white-space: pre-line; }
.hz-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hz-action { background: #f0fdf4; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; margin-top: 6px; }
.hz-st { border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.s-new { background: #dbeafe; color: #1d4ed8; } .s-review { background: #fef3c7; color: #b45309; } .s-in_progress { background: #ffedd5; color: #c2410c; }
.s-resolved { background: #dcfce7; color: #15803d; } .s-rejected { background: #f1f5f9; color: #64748b; }
.hz-rk { border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.hz-rk.r-low { background: #dcfce7; color: #15803d; } .hz-rk.r-medium { background: #fef9c3; color: #854d0e; } .hz-rk.r-high { background: #fee2e2; color: var(--hz-dark); }
.hz-empty { text-align: center; padding: 40px 10px; font-size: 40px; }
.hz-empty p { font-size: 15px; color: var(--muted); }
.hz-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.hz-modal-card { background: #fff; border-radius: 16px; padding: 18px; max-width: 460px; font-size: 14.5px; }
.hz-modal-card h3 { margin-top: 0; color: var(--hz-dark); }
.hz-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 9999; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* Админ: аюулын мэдээлэл, SP */
.tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; line-height: 18px; margin-left: 4px; }
#hzTable tr.hz-row { cursor: pointer; }
#hzTable tr.hz-row:hover td { background: #f8fafc; }
#hzTable tr.urgent td { background: #fef2f2; }
#hzTable tr.urgent td:first-child { box-shadow: inset 4px 0 0 #dc2626; color: #b91c1c; }
.hz-admin-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .hz-admin-grid { grid-template-columns: 1.15fr 1fr; } }
.hz-dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0 0 10px; font-size: 14px; }
.hz-dl dt { color: var(--muted); } .hz-dl dd { margin: 0; }
.hz-desc { background: #fef2f2; border-radius: 10px; padding: 10px 12px; white-space: pre-line; font-size: 14.5px; }
.hz-map { margin-top: 10px; }
.hz-map iframe { width: 100%; height: 230px; border: 1px solid var(--line); border-radius: 10px; }
.hz-map a { font-size: 13px; font-weight: 700; }
.hz-events { list-style: none; padding: 0; margin: 0; font-size: 13px; border-left: 2px solid var(--line); }
.hz-events li { padding: 4px 0 6px 10px; }
dialog.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: rgba(0,0,0,.9); cursor: zoom-out; }
dialog.lightbox[open] { display: flex; align-items: center; justify-content: center; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.6); }
.lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 8px; }
.lightbox button { position: absolute; top: 14px; right: 18px; background: none; border: 0; color: #fff; font-size: 36px; cursor: pointer; }
#hzTable td:first-child, #hzTable td:nth-child(2) { white-space: nowrap; }

/* ---------------- Энэ долоо хоног ---------------- */
.week { position: relative; }
.wk-head h3 { margin: 0 0 10px; font-size: 16px; color: var(--ink); }
.wk-progress { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wk-bar { flex: 1; min-width: 120px; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
.wk-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .9s cubic-bezier(.22, 1, .36, 1); }
.wk-count { font-size: 14px; color: var(--ink); min-width: 30px; text-align: right; }
.wk-fire { font-size: 13px; font-weight: 800; color: #c2410c; background: #fff7ed; border-radius: 999px; padding: 2px 10px; animation: annIn .4s ease-out; }
.wk-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 14px; }
.wk-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; height: 52px; padding: 0;
  border-radius: 10px; border: 1.5px solid transparent; background: #f1f5f9; font: inherit; cursor: pointer; color: var(--ink); }
.wk-chip span { font-size: 12px; font-weight: 700; }
.wk-chip i { font-style: normal; font-size: 13px; line-height: 14px; height: 14px; }
.wk-chip.done { background: #16a34a; color: #fff; }
.wk-chip.done i { font-weight: 900; }
.wk-chip.today { background: #fff; border-color: var(--blue-600); color: var(--blue-700); box-shadow: 0 0 0 2px var(--blue-100); }
.wk-chip.past { color: #475569; }
.wk-chip.past i { color: #94a3b8; }
.wk-chip.future { color: #cbd5e1; cursor: default; }
.wk-chip.future i { color: #cbd5e1; }
.wk-chip.sel { outline: 2px solid var(--blue-500); outline-offset: 1px; }
.wk-pop { position: absolute; z-index: 5; margin-top: 8px; width: 236px; background: #0f172a; color: #fff; border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.55; box-shadow: 0 10px 24px rgba(15,23,42,.25); animation: annIn .2s ease-out; }
.wk-pop .wk-ok { color: #4ade80; font-weight: 700; } .wk-pop .wk-miss { color: #fca5a5; font-weight: 700; }
.wk-pop .wk-sp { color: #4ade80; }
.wk-foot { margin-top: 14px; font-size: 14px; color: #334155; }
.wk-foot b { color: #16a34a; font-size: 17px; }
@media (max-width: 380px) { .wk-chips { gap: 4px; } .wk-chip { height: 48px; border-radius: 9px; } .wk-chip span { font-size: 11.5px; } }

/* ---------------- Нэвтрэх маягт: алдааны мессеж, нууц үг харах ---------------- */
input.invalid { border-color: var(--bad) !important; background: #fff7f7; }
input.invalid:focus { box-shadow: 0 0 0 3px var(--bad-bg); }
.field-err { color: var(--bad); font-size: 13px; font-weight: 600; margin: 4px 0 2px; }
.field-err:empty { display: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-eye { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; border-radius: 10px;
  font-size: 20px; cursor: pointer; opacity: .55; display: inline-flex; align-items: center; justify-content: center; }
.pw-eye:hover, .pw-eye.on { opacity: 1; }
.pw-eye.on { background: var(--blue-50); }
#forgotBox { margin-top: 8px; }
.hz-call { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 6px; margin-top: 8px; min-height: 44px; padding: 6px 10px; border-radius: 10px; text-align: center;
  background: var(--hz); color: #fff; font-weight: 800; font-size: 15px; text-decoration: none; }
.nowrap { white-space: nowrap; }
.hz-call:active { background: var(--hz-dark); }


/* Алхмын мөр: "Дадлага" заавал биш */
.daytrack .step.optional { border-style: dashed; opacity: .72; background: #fff; }
.daytrack .step.optional i { border-style: dashed; border-color: #cbd5e1; }
.daytrack .step.optional.ok { opacity: 1; border-style: solid; }
.daytrack .step span { display: flex; flex-direction: column; line-height: 1.25; }
.opt-note { font-size: 11px; color: #64748b; font-weight: 500; }
.day-done { margin: -4px 0 12px; font-size: 13px; font-weight: 700; color: var(--ok); }

/* Нэвтрэх хуудсын тайлбар, нууц үг сэргээх */
.app-intro { text-align: center; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.app-intro b { display: block; font-size: 18px; color: var(--blue-900); }
.app-intro p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: #64748b; }
.forgot { margin-top: 10px; background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.forgot p { margin: 0 0 10px; }
.contact { display: grid; gap: 4px; }
.contact-row { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--ink); text-decoration: none; }
.contact-row span { width: 22px; text-align: center; }
a.contact-row { color: var(--blue-700); font-weight: 700; }
a.contact-row:hover { text-decoration: underline; }

/* ---------------- Админ: бүлэглэсэн хажуугийн цэс ---------------- */
.admin-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 18px; align-items: start; }
.side { position: sticky; top: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); max-height: calc(100vh - 24px); overflow-y: auto; }
.side-nav { display: block; margin: 0; padding: 0; overflow: visible; }
.grp + .grp { margin-top: 4px; }
.grp-h { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 800; color: var(--blue-900);
  text-transform: none; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; }
.grp-h:hover { background: var(--blue-50); }
.grp-h .chev { margin-left: auto; transition: transform .2s; color: var(--muted); font-style: normal; }
.grp:not(.open) .chev { transform: rotate(-90deg); }
.grp-items { display: grid; gap: 2px; padding: 2px 0 6px 6px; }
.grp:not(.open) .grp-items { display: none; }
.side-nav .grp-items button { width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 14px; color: #334155; padding: 8px 10px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; border-left: 3px solid transparent; }
.side-nav .grp-items button:hover { background: #f1f5f9; }
.side-nav .grp-items button.active { background: var(--blue-600); color: #fff; font-weight: 700; }
.side-nav .tab-badge, .grp-badge { margin-left: auto; }
.grp-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.menu-btn { display: none; }
.cur-tab { display: none; }
.side-backdrop { display: none; }
@media (max-width: 899px) {
  .admin-layout { display: block; }
  .menu-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.16); border: 0; color: #fff; font: inherit; font-weight: 700; border-radius: 10px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
  .cur-tab { display: block; font-weight: 800; color: var(--blue-900); margin: 0 0 10px; font-size: 16px; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); max-height: none; z-index: 80; border-radius: 0 16px 16px 0; transform: translateX(-105%); transition: transform .22s ease; padding-top: 14px; }
  .side.open { transform: none; }
  .side-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 79; }
  .side-backdrop.show { display: block; }
}
.report-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.report-item { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.report-item b { color: var(--blue-900); }
.report-item small { color: var(--muted); }
.report-item .btn { align-self: flex-start; }
button.kpi-link { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.kpi-link:hover { border-color: #fca5a5; }
