:root {
  /* Techpros logo palette: navy + cyan */
  --bg: #f2f6f9; --card: #ffffff; --text: #122b3d; --muted: #5b7285;
  --brand: #14344e; --brand-2: #1ca8d8; --border: #dde7ee;
  --green: #16a34a; --amber: #f59e0b; --red: #dc2626; --gray: #94a3b8;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--brand-2); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; margin: 28px 0 12px; } h3 { margin-top: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }

/* Auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { max-width: 460px; width: 100%; padding: 32px; }
.brand-badge { display: inline-block; background: var(--brand); color: #fff; font-weight: 700; padding: 4px 12px; border-radius: 6px; letter-spacing: .05em; margin-bottom: 8px; }
.brand-badge.sm { font-size: .75rem; padding: 2px 8px; margin: 0 6px 0 0; }
.logo { height: 56px; max-width: 95%; object-fit: contain; margin-bottom: 14px; }
.logo-sm { height: 56px; width: auto; object-fit: contain; display: block; flex-shrink: 0; }
.topbar-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-brand strong { white-space: nowrap; }
.print-header .logo { height: 40px; margin-bottom: 6px; }

/* Forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
input:focus, textarea:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.btn { display: inline-block; border: 1px solid var(--border); background: #fff; color: var(--text); padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; margin-top: 16px; width: 100%; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 3px 8px; font-size: .8rem; border-radius: 6px; }
.btn.danger { border-color: var(--red); color: var(--red); }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; }
.row-form input { flex: 1; min-width: 160px; }
.row-form .btn { margin: 0; width: auto; }

.alert { padding: 12px 14px; border-radius: 8px; margin: 12px 0; }
.alert.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1000px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { background: var(--brand); color: #fff; border-radius: 99px; padding: 3px 12px; font-size: .85rem; font-weight: 600; }
.progress-track { height: 4px; background: var(--border); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .3s; }

/* Section nav */
.section-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.chip { background: #fff; border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; font-size: .82rem; text-decoration: none; color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--brand-2); }
.chip-count { color: var(--muted); margin-left: 4px; font-size: .78rem; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.chip.active .chip-count { color: #cbd5e1; }
.chip.done { border-color: var(--green); }
.chip.done .chip-count { color: var(--green); font-weight: 700; }
.chip.done.active { background: var(--green); border-color: var(--green); }
.chip.done.active .chip-count { color: #dcfce7; }

/* Зөвхөн сонгосон бүлэг харагдана */
.qsection { display: none; }
.qsection.active { display: block; }
.sec-btns { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 6px; gap: 10px; }
.sec-btns .next { background: var(--brand); border-color: var(--brand); color: #fff; }
.sec-btns .next:hover { background: var(--brand-2); }

/* Questions */
.qcard { padding: 16px 18px; }
.ref-badge { display: inline-block; background: #e7f6fc; color: var(--brand); font-weight: 700; font-size: .78rem; padding: 2px 8px; border-radius: 6px; border: 1px solid #b9e5f4; white-space: nowrap; }
.q-mn { font-weight: 600; margin: 10px 0 4px; }
.q-en { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.opt { border: 1.5px solid var(--border); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: .88rem; font-weight: 600; user-select: none; }
.opt input { display: none; }
.opt:hover { border-color: var(--gray); }
.opt-fully.sel { background: var(--green); border-color: var(--green); color: #fff; }
.opt-partially.sel { background: var(--amber); border-color: var(--amber); color: #fff; }
.opt-not.sel { background: var(--red); border-color: var(--red); color: #fff; }
.opt-na.sel { background: var(--gray); border-color: var(--gray); color: #fff; }
textarea.notes { resize: vertical; min-height: 38px; font-size: .88rem; }

/* Нотлох баримт */
.ev-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.ev-item { font-size: .8rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; }
.ev-x { border: none; background: none; color: var(--red); cursor: pointer; font-size: .8rem; padding: 0 2px; }
.ev-add { font-size: .8rem; font-weight: 600; color: var(--brand-2); cursor: pointer; }
.ev-add:hover { text-decoration: underline; }

/* Зорилго, ач холбогдол */
details.purpose { margin: 0 0 12px; border: 1px solid var(--brand-2); border-left: 4px solid var(--brand-2); border-radius: 8px; background: #e9f7fc; overflow: hidden; }
details.purpose summary { cursor: pointer; padding: 9px 14px; font-size: .86rem; font-weight: 700; color: var(--brand); user-select: none; display: flex; align-items: center; gap: 8px; }
details.purpose summary::after { content: '▾ дарж унших'; margin-left: auto; font-size: .76rem; font-weight: 600; color: var(--brand-2); }
details.purpose[open] summary::after { content: '▴ хаах'; }
details.purpose summary:hover { background: #d9f1fa; }
details.purpose[open] summary { border-bottom: 1px dashed #a8ddf0; background: #f0fafd; }
details.purpose p { margin: 0; padding: 10px 16px 13px; font-size: .87rem; color: #21455f; line-height: 1.6; background: #f7fcfe; }
.p-label { display: block; font-weight: 800; color: #0e7fb0; margin-bottom: 2px; }
.p-label.p-label2 { margin-top: 10px; color: var(--brand); }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { text-align: center; padding: 20px 10px; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--brand); }
.stat-label { color: var(--muted); font-size: .85rem; }
.chart-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 760px) { .chart-grid { grid-template-columns: 1fr; } }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; background: #f8fafc; border-bottom: 2px solid var(--border); padding: 8px; }
.tbl td { border-bottom: 1px solid var(--border); padding: 8px; vertical-align: top; }
.c-green { color: var(--green); font-weight: 700; } .c-amber { color: var(--amber); font-weight: 700; }
.c-red { color: var(--red); font-weight: 700; } .c-gray { color: var(--gray); }
.mini-track { height: 5px; background: var(--border); border-radius: 3px; margin-top: 4px; width: 90px; }
.mini-fill { height: 100%; background: var(--brand-2); border-radius: 3px; }
.actions { white-space: nowrap; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-weight: 700; }

/* Print */
.print-header { display: none; }
@media print {
  .noprint, .topbar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .print-header { display: block; text-align: center; margin-bottom: 20px; }
}
