/* Өртөг бүрдэлтийн системийн нэмэлт загвар (style.css дээр) */
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.tools .form-group { margin: 0; }
.tools .grow { flex: 1 1 220px; }
.ct td, .ct th { padding: 7px 8px; font-size: 12.5px; }
.ct th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.ct td.num, .ct th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ct tfoot td { font-weight: bold; background: #f4f7fb; border-top: 2px solid #e5e9f0; }
.ct tr.click { cursor: pointer; }
.ct tr.click:hover td { background: #f5f9ff; }
.ct .sub { display: block; color: #8993a5; font-size: 11.5px; margin-top: 2px; }
.ct th[data-sort] { cursor: pointer; }
.ct th[data-sort]:hover { color: #1d4ed8; }
.scroll { overflow-x: auto; }
.neg { color: #dc2626; font-weight: bold; }
.pos { color: #15945b; font-weight: bold; }
.muted { color: #8993a5; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; white-space: nowrap; margin: 1px 2px 1px 0; }
.badge.ok { background: #e7f8ef; color: #12734a; }
.badge.warn { background: #fff3dc; color: #9a5b00; }
.badge.bad { background: #feecec; color: #b42318; }
.badge.info { background: #eef4ff; color: #1d4ed8; }
.badge.gray { background: #f1f3f7; color: #667085; }
.sec { margin-bottom: 18px; }
.sec h3 { font-size: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; }
.fgrid .form-group label { font-size: 12px; }
.fgrid .form-group input, .fgrid .form-group select { padding: 9px 10px; font-size: 13px; }
.fgrid .calc { background: #f5f7fa; border: 1px solid #e5e9f0; border-radius: 9px; padding: 9px 10px; font-size: 13px; font-weight: bold; font-variant-numeric: tabular-nums; }
.lines input { padding: 6px 7px; font-size: 12.5px; min-width: 0; width: 100%; }
.lines input.w-code { width: 78px; } .lines input.w-s { width: 64px; } .lines input.w-m { width: 92px; } .lines input.w-l { width: 170px; }
.lines td { vertical-align: top; }
.lines td.calc { background: #fafbfd; }
.lines tr.flag td { background: #fffaf0; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid #e5e9f0; padding: 12px 0; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; z-index: 5; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid #e5e9f0; background: #fff; border-radius: 99px; padding: 8px 14px; font-size: 13px; cursor: pointer; color: #344054; }
.tabs button.on { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #eef1f5; padding: 4px 0; }
.kv b { font-variant-numeric: tabular-nums; }
.warnbox { background: #fff8e6; border: 1px solid #f5d98a; color: #8a6100; border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
.okbox { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.lockbar { padding: 10px 14px; border-radius: 10px; background: #e7f8ef; color: #12734a; font-size: 13px; margin-bottom: 14px; }
.sm-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow: auto; }
.sm { background: #fff; border-radius: 14px; width: min(860px, 100%); padding: 20px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.sm h3 { margin: 0 0 8px; }
.sm .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.sm textarea { width: 100%; min-height: 180px; font-family: ui-monospace, monospace; font-size: 12px; padding: 10px; border: 1px solid #d0d5dd; border-radius: 9px; }
.loading { padding: 40px; text-align: center; color: #8993a5; }
body.role-viewer [data-write], body.role-sales [data-write] { display: none !important; }
@media (max-width: 760px) { .fgrid { grid-template-columns: 1fr 1fr; } }
@media print { .sidebar, .nav-toggle, .no-print, .sticky-actions, .tools { display: none !important; } .main { margin: 0 !important; padding: 0 !important; } }

.ac-pop { position: absolute; z-index: 1000; width: 460px; max-height: 340px; overflow: auto; background: #fff; border: 1px solid #d0d7e2; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.18); padding: 4px; }
.ac-it { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.ac-it small { color: #8993a5; white-space: nowrap; }
.ac-it.on, .ac-it:hover { background: #eef4ff; }
.ac-empty { padding: 8px 10px; color: #8993a5; font-size: 12.5px; }
