/* ==========================================================================
   ЭМДЕГ Дотоод портал – дизайны систем (Bootstrap 5.3 дээр).

   Зарчим:
   - Нэг газар тодорхойлсон токен (өнгө, бичвэр, зай, булан, сүүдэр) – компонент бүр эндээс авна.
   - Хөх-цагаан төрх (Засгийн газрын pm.hrs.gov.mn-тэй ойролцоо): гүн хөх хажуу цэс, цайвар
     саарал-хөх дэвсгэр, цагаан карт. Логоны цэнхэр-ногоон нь зөвхөн жижиг нарийн зурвасанд.
   - Товч, холбоос WCAG 2.1 AA тодролтой (≥4.5:1).
   - Фонт: typography.css (Inter Tight / Inter / JetBrains Mono), дэлгэцэнд 14px (Inter-ийн x-өндөр том), 1.55 мөр хоорондын зай.
   - Тоо харьцуулах газар tabular-nums; гарнаас удирдахад :focus-visible тод хүрээ.
   ========================================================================== */

:root {
  /* Брэнд (логоноос) */
  --emd-blue: #1c86c2;
  --emd-teal: #359b9d;
  --emd-green: #6dc55f;
  --emd-gradient: linear-gradient(90deg, var(--emd-blue) 0%, var(--emd-teal) 55%, var(--emd-green) 100%);

  /* Үндсэн өнгө – гүн хөх, цагаан бичвэртэй 10:1 */
  --emd-primary: #26348f;
  --emd-primary-hover: #1c2774;
  --emd-primary-soft: #eceefa;
  --emd-primary-line: #c8cdee;

  /* Хажуу цэс (гүн хөх) */
  --nav-bg: #1f2a7c;
  --nav-bg-2: #19226a;
  --nav-ink: rgba(255, 255, 255, .84);
  --nav-muted: rgba(255, 255, 255, .55);
  --nav-hover: rgba(255, 255, 255, .08);
  --nav-active: rgba(255, 255, 255, .15);

  /* Саарал (бага зэрэг цэнхэр өнгө аястай) */
  --n-0: #ffffff;
  --n-25: #f8f9fc;
  --n-50: #f2f4f8;
  --n-100: #e8ebf2;
  --n-200: #dde1ea;
  --n-300: #c8d0d9;
  --n-400: #98a4b0;
  --n-500: #66727f;   /* туслах бичвэр – цагаан дээр 4.8:1 */
  --n-600: #4b5764;
  --n-700: #33404d;
  --n-900: #16202b;   /* үндсэн бичвэр */

  /* Утгын өнгө */
  --emd-green-strong: #1f7a3d;
  --emd-green-soft: #e8f5ec;
  --emd-warning: #8a5a00;
  --emd-warning-soft: #fff4d6;
  --emd-danger: #c4282d;
  --emd-danger-soft: #fdecec;

  /* Хуучин нэрс – бусад компонент ашигладаг */
  --emd-bg: var(--n-50);
  --emd-border: var(--n-200);
  --emd-ink: var(--n-900);
  --emd-slate: var(--n-700);
  --emd-muted: var(--n-500);

  /* Хэмжээ */
  --emd-topbar-h: 56px;
  --emd-sidebar-w: 272px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(22, 32, 43, .05);
  --shadow-sm: 0 1px 3px rgba(22, 32, 43, .07), 0 1px 2px rgba(22, 32, 43, .04);
  --shadow-md: 0 10px 28px rgba(22, 32, 43, .10), 0 2px 6px rgba(22, 32, 43, .05);

  /* Bootstrap-ийн хувьсагчид */
  --bs-font-sans-serif: var(--font-body);
  --bs-font-monospace: var(--font-mono);
  --bs-body-font-size: .875rem;
  --bs-body-line-height: 1.55;
  --bs-body-bg: var(--n-50);
  --bs-body-color: var(--n-900);
  --bs-secondary-color: var(--n-500);
  --bs-emphasis-color: var(--n-900);
  --bs-primary: var(--emd-primary);
  --bs-primary-rgb: 38, 52, 143;
  --bs-primary-bg-subtle: var(--emd-primary-soft);
  --bs-primary-border-subtle: var(--emd-primary-line);
  --bs-primary-text-emphasis: #19226a;
  --bs-success: var(--emd-green-strong);
  --bs-success-rgb: 31, 122, 61;
  --bs-success-bg-subtle: var(--emd-green-soft);
  --bs-danger: var(--emd-danger);
  --bs-danger-rgb: 196, 40, 45;
  --bs-link-color: var(--emd-primary);
  --bs-link-color-rgb: 38, 52, 143;
  --bs-link-hover-color: var(--emd-primary-hover);
  --bs-link-hover-color-rgb: 28, 39, 116;
  --bs-border-color: var(--n-200);
  --bs-border-radius: var(--r-sm);
  --bs-border-radius-lg: var(--r-md);
  --bs-border-radius-xl: var(--r-lg);
  --bs-focus-ring-color: rgba(38, 52, 143, .22);
}

html { -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4, h5, h6 { color: var(--n-900); letter-spacing: -.01em; }
.text-muted, .text-body-secondary { color: var(--n-500) !important; }
.num, .table, .stat, .badge, .kpi { font-variant-numeric: tabular-nums; }
::selection { background: #d6dbf6; }

/* Гарнаас удирдахад харагдах тод хүрээ (хулганаар дарахад гарахгүй) */
:focus-visible { outline: 2px solid var(--emd-primary); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 2000; background: #fff; padding: .5rem .9rem; border-radius: var(--r-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { left: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* --- Товч, форм ---------------------------------------------------------- */
.btn { font-weight: 550; --bs-btn-padding-x: .9rem; --bs-btn-border-radius: var(--r-sm); }
.btn-sm { --bs-btn-padding-x: .6rem; }
.btn-primary {
  --bs-btn-bg: var(--emd-primary);
  --bs-btn-border-color: var(--emd-primary);
  --bs-btn-hover-bg: var(--emd-primary-hover);
  --bs-btn-hover-border-color: var(--emd-primary-hover);
  --bs-btn-active-bg: var(--emd-primary-hover);
  --bs-btn-active-border-color: var(--emd-primary-hover);
  --bs-btn-disabled-bg: var(--emd-primary);
  --bs-btn-disabled-border-color: var(--emd-primary);
  --bs-btn-focus-shadow-rgb: 38, 52, 143;
}
.btn-outline-primary {
  --bs-btn-color: var(--emd-primary);
  --bs-btn-border-color: var(--emd-primary-line);
  --bs-btn-hover-bg: var(--emd-primary-soft);
  --bs-btn-hover-color: var(--emd-primary-hover);
  --bs-btn-hover-border-color: var(--emd-primary);
  --bs-btn-active-bg: var(--emd-primary-soft);
  --bs-btn-active-color: var(--emd-primary-hover);
  --bs-btn-active-border-color: var(--emd-primary);
  --bs-btn-focus-shadow-rgb: 38, 52, 143;
}
.btn-outline-secondary {
  --bs-btn-color: var(--n-700);
  --bs-btn-border-color: var(--n-200);
  --bs-btn-bg: #fff;
  --bs-btn-hover-bg: var(--n-50);
  --bs-btn-hover-color: var(--n-900);
  --bs-btn-hover-border-color: var(--n-300);
  --bs-btn-active-bg: var(--n-100);
  --bs-btn-active-color: var(--n-900);
  --bs-btn-active-border-color: var(--n-300);
}
.btn-success {
  --bs-btn-bg: var(--emd-green-strong);
  --bs-btn-border-color: var(--emd-green-strong);
  --bs-btn-hover-bg: #186531;
  --bs-btn-hover-border-color: #186531;
  --bs-btn-active-bg: #186531;
}
.form-control, .form-select { border-color: var(--n-200); border-radius: var(--r-sm); }
.form-control:hover, .form-select:hover { border-color: var(--n-300); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--emd-primary);
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}
.form-control::placeholder { color: var(--n-400); }
.form-check-input:checked { background-color: var(--emd-primary); border-color: var(--emd-primary); }
.form-label { font-weight: 550; font-size: .85rem; color: var(--n-700); margin-bottom: .3rem; }
.form-text { color: var(--n-500); font-size: .8rem; }

.bi {
  width: 1em; height: 1em;
  vertical-align: -.125em;
  fill: currentColor;
  flex-shrink: 0;
}

/* --- Дээд мөр ------------------------------------------------------------ */
.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--emd-topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--n-200);
  display: flex; align-items: center; gap: .5rem;
  padding: 0 1rem 0 .75rem;
}
.topbar-crumb { font-size: .85rem; color: var(--n-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app-brand {
  display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; min-width: 0;
  min-height: 80px; padding: .85rem 1rem; flex: 1 1 0; position: relative;
}
.app-brand:hover { color: #fff; }
.app-brand::after { /* логоны өнгөний нарийн зурвас – брэндийн ганц градиент */
  content: ""; position: absolute; left: 1.15rem; right: 1.15rem; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--emd-gradient); opacity: .9;
}
/* Бичигтэй цагаан лого (хүрээгүй). Хураасан цэсэнд зөвхөн тэмдэг. */
.app-brand .brand-mark { flex-shrink: 0; display: none; }
.app-brand .brand-mark img { width: 36px; height: 36px; }
.app-brand .brand-title { display: flex; min-width: 0; }
.app-brand .brand-title img { height: 62px; width: auto; max-width: 100%; display: block; }
.topbar-btn {
  border: 0; background: transparent; color: var(--n-600);
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.topbar-btn:hover { background: var(--n-100); color: var(--n-900); }
.topbar-search {
  display: inline-flex; align-items: center; gap: .55rem; flex: 0 1 380px; min-width: 0;
  height: 36px; padding: 0 .55rem 0 .75rem; margin-left: auto;
  background: var(--n-50); border: 1px solid var(--n-200); border-radius: var(--r-sm);
  color: var(--n-500); font-size: .875rem; text-align: left;
}
.topbar-search:hover { border-color: var(--n-300); background: #fff; }
.topbar-search span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kbd {
  font: 600 .7rem/1 var(--bs-font-sans-serif); color: var(--n-500);
  border: 1px solid var(--n-200); border-bottom-width: 2px; border-radius: 4px; padding: .2rem .35rem; background: #fff;
}
.topbar-create { white-space: nowrap; }
@media (max-width: 767.98px) {
  .topbar-search { flex: 0 0 38px; width: 38px; padding: 0; justify-content: center; background: transparent; border-color: transparent; }
  .topbar-search span, .topbar-search .kbd { display: none; }
  .topbar-create .label { display: none; }
}
.user-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid transparent; border-radius: 2rem;
  padding: .2rem .6rem .2rem .2rem; background: transparent; color: var(--n-900);
}
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--n-100); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--emd-primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 650; font-size: .8rem;
}
.dropdown-menu {
  --bs-dropdown-border-color: var(--n-200); --bs-dropdown-border-radius: var(--r-md);
  --bs-dropdown-link-hover-bg: var(--n-50); --bs-dropdown-link-active-bg: var(--emd-primary-soft);
  --bs-dropdown-link-active-color: var(--emd-primary); --bs-dropdown-font-size: .9rem;
  box-shadow: var(--shadow-md); padding: .35rem;
}
.dropdown-item { border-radius: var(--r-sm); padding: .45rem .65rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item .bi { color: var(--n-500); }
.dropdown-header { font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--n-500); }

/* --- Хажуу цэс ----------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-sidebar {
  --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--nav-bg);
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%); color: var(--nav-ink);
  display: flex; flex-direction: column;
}
.app-sidebar .side-nav { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.app-sidebar .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.side-foot { flex-shrink: 0; padding: .8rem 1.15rem 1rem; border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: .72rem; line-height: 1.45; color: var(--nav-muted); }
.side-foot div:first-child { color: var(--nav-ink); font-weight: 600; }
@media (min-width: 992px) {
  .app-sidebar {
    width: var(--emd-sidebar-w); flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
  }
}
.side-group { padding: .15rem 0; }
.side-section {
  display: flex; align-items: center; width: 100%; border: 0; background: none;
  font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
  color: var(--nav-muted); padding: .9rem 1.15rem .35rem; text-align: left;
}
.side-section .chev { margin-left: auto; font-size: .75rem; transition: transform .15s; }
.side-group.closed .side-section .chev { transform: rotate(-90deg); }
.side-group.closed .side-items { display: none; }
.side-section:hover { color: #fff; }
.side-link {
  display: flex; align-items: center; gap: .7rem;
  margin: 1px .6rem; padding: .45rem .65rem; min-height: 36px;
  border-radius: var(--r-md); color: var(--nav-ink); text-decoration: none; font-weight: 500; font-size: .9rem;
  position: relative;
}
.side-link .bi { font-size: 1.05rem; color: var(--nav-muted); }
.side-link:hover { background: var(--nav-hover); color: #fff; }
.side-link:hover .bi { color: #fff; }
.side-link.active { background: var(--nav-active); color: #fff; font-weight: 650; }
.side-link.active .bi { color: #fff; }
.side-link:focus-visible { outline-color: #fff; }
.side-link .badge { margin-left: auto; font-size: .68rem; font-weight: 700; background: #fff !important; color: var(--nav-bg) !important; }

/* Хураасан цэс (зөвхөн том дэлгэцэнд): зөвхөн icon, бичвэрийг tooltip-оор (title) харуулна. */
@media (min-width: 992px) {
  .app-sidebar { transition: width .2s ease; }
  .sidebar-collapsed .app-sidebar { width: 68px; overflow-x: hidden; }
  .sidebar-collapsed .side-link { justify-content: center; padding: .55rem 0; margin: 2px .6rem; }
  .sidebar-collapsed .side-link .label { display: none; }
  .sidebar-collapsed .side-link .badge {
    position: absolute; top: 2px; right: 2px; margin: 0; font-size: .58rem; padding: .2em .4em;
  }
  .sidebar-collapsed .side-section { font-size: 0; padding: .5rem 1rem .25rem; pointer-events: none; }
  .sidebar-collapsed .side-section::after { content: ""; display: block; width: 100%; height: 1px; background: rgba(255,255,255,.15); }
  .sidebar-collapsed .app-brand { padding: 0; justify-content: center; }
  .sidebar-collapsed .app-brand .brand-title { display: none; }
  .sidebar-collapsed .app-brand .brand-mark { display: inline-flex; }
  .sidebar-collapsed .app-brand::after { left: .9rem; right: .9rem; }
  .sidebar-collapsed .side-foot { display: none; }
  .sidebar-collapsed .side-section .chev { display: none; }
  .sidebar-collapsed .side-group.closed .side-items { display: block; }
}

/* --- Үндсэн хэсэг -------------------------------------------------------- */
.app-main { flex: 1; min-width: 0; padding: 1.5rem 1.75rem; display: flex; flex-direction: column; }
.app-content { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; }
.app-content.narrow { max-width: 1180px; }
.app-content.reading { max-width: 1080px; }
.app-footer {
  margin-top: 2.5rem; padding: 1rem 0 .25rem;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  color: var(--n-500); font-size: .78rem;
}
@media (max-width: 575.98px) { .app-main { padding: 1rem; } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 650; margin: 0; line-height: 1.25; }
.page-head .sub { color: var(--n-500); font-size: .875rem; margin-top: .15rem; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) {
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions > .btn { flex: 1; }
}
main h1.h4, main h1.h5 { font-weight: 650; }

.card { --bs-card-border-color: var(--n-200); --bs-card-border-radius: var(--r-md); --bs-card-inner-border-radius: calc(var(--r-md) - 1px); box-shadow: var(--shadow-xs); }
.card-header { background: #fff; border-bottom-color: var(--n-200); font-weight: 650; font-size: .92rem; }
.section-title { font-size: .95rem; font-weight: 650; color: var(--n-700); margin-bottom: .75rem; }

.table { --bs-table-bg: #fff; --bs-table-border-color: var(--n-100); }
.table > thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--n-600); font-weight: 650; background: var(--n-100); white-space: nowrap;
  border-bottom-color: var(--n-200);
}
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--n-25); }
.table-card { border: 1px solid var(--n-200); border-radius: var(--r-md); overflow: hidden; background: #fff; box-shadow: var(--shadow-xs); }
.table-card .table { margin: 0; }

.nav-tabs { --bs-nav-tabs-border-color: var(--n-200); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs .nav-link { color: var(--n-600); font-weight: 550; white-space: nowrap; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link:hover { color: var(--n-900); border-bottom-color: var(--n-300); }
.nav-tabs .nav-link.active { color: var(--emd-primary); border-bottom-color: var(--emd-primary); background: transparent; }
.pagination { --bs-pagination-active-bg: var(--emd-primary); --bs-pagination-active-border-color: var(--emd-primary); --bs-pagination-color: var(--emd-primary); }
.progress { --bs-progress-bar-bg: var(--emd-teal); background: var(--n-100); }
.badge { font-weight: 600; }

/* Сегментлэсэн шүүлтүүр (табын товч хэлбэр) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--n-100); border-radius: var(--r-sm); }
.segmented a { padding: .3rem .8rem; border-radius: 5px; color: var(--n-600); font-weight: 550; font-size: .85rem; text-decoration: none; white-space: nowrap; }
.segmented a:hover { color: var(--n-900); }
.segmented a.active { background: #fff; color: var(--n-900); box-shadow: var(--shadow-sm); }

/* Хоосон төлөв */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--n-500); }
.empty-state .bi { font-size: 2rem; color: var(--n-300); margin-bottom: .5rem; }

/* --- Нүүр, хяналтын тоон хавтан ----------------------------------------- */
.stat {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem;
  background: #fff; border: 1px solid var(--emd-border); border-radius: var(--r-md); height: 100%;
}
.stat .ico {
  width: 44px; height: 44px; border-radius: .65rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem;
  background: var(--emd-primary-soft); color: var(--emd-primary);
}
.stat .ico.green { background: var(--emd-green-soft); color: var(--emd-green-strong); }
.stat .ico.teal { background: #e3f3f3; color: #23797b; }
.stat .ico.amber { background: #fff4de; color: #a26800; }
.stat .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 650; line-height: 1; letter-spacing: -.02em; }
.stat .lbl { font-size: .8rem; color: var(--n-500); }

@media (max-width: 575.98px) {
  .stat { flex-direction: column; align-items: flex-start; gap: .5rem; padding: .85rem; }
  .stat .ico { width: 36px; height: 36px; font-size: 1.1rem; }
  .stat .num { font-size: 1.4rem; }
  .quick-card { padding: .9rem; }
  .quick-card .ico { font-size: 1.35rem; margin-bottom: .25rem; }
  .quick-card h3 { font-size: .9rem; }
  .quick-card p { font-size: .78rem; }
  .hero { padding: 1.25rem; }
  .hero h1 { font-size: 1.2rem; }
}

.quick-card {
  display: block; text-decoration: none; color: inherit; height: 100%;
  background: #fff; border: 1px solid var(--emd-border); border-radius: var(--r-md); padding: 1.25rem;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.quick-card:hover { border-color: var(--emd-primary-line); box-shadow: 0 6px 18px rgba(38, 52, 143, .08); transform: translateY(-1px); color: inherit; }
.quick-card .ico { font-size: 1.6rem; color: var(--emd-primary); margin-bottom: .5rem; display: inline-block; }
.quick-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.quick-card p { color: var(--n-500); font-size: .85rem; margin: 0; }

/* Баннер: ногоон руу шилжихгүй, гүн цэнхэрээс ногоон-цэнхэр рүү тайван градиент. */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); color: #fff;
  background: linear-gradient(115deg, #1f2a7c 0%, #26348f 55%, #3446a8 100%);
  padding: 1.5rem 1.75rem; margin-bottom: 1.5rem;
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--emd-gradient);
}
.hero h1, .hero h2 { color: #fff; font-size: 1.4rem; font-weight: 600; margin-bottom: .25rem; }
.hero p { margin: 0; opacity: .85; }
.hero .hero-mark { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 92px; opacity: .1; filter: brightness(0) invert(1); }

/* --- Нэвтрэх хуудас ------------------------------------------------------ */
.auth-page { min-height: 100vh; display: flex; background: var(--emd-bg); }
.auth-brand {
  flex: 1 1 50%; display: none; position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(155deg, #19226a 0%, #26348f 55%, #3446a8 100%);
  padding: 3rem;
}
.auth-brand .mark-bg { position: absolute; right: -80px; bottom: -80px; width: 420px; opacity: .12; filter: brightness(0) invert(1); }
.auth-brand .brand-logo { height: 84px; width: auto; display: block; position: relative; }
.auth-brand h1, .auth-brand h2 { color: #fff; font-size: 1.8rem; font-weight: 600; margin-top: 3rem; max-width: 26rem; }
.auth-brand ul { list-style: none; padding: 0; margin-top: 1.5rem; opacity: .95; }
.auth-brand li { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; }
@media (min-width: 992px) { .auth-brand { display: flex; flex-direction: column; } }
.auth-form-wrap { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card-body { padding: 2rem; }
.auth-card .mobile-logo { height: 56px; width: auto; }
.auth-footer { color: var(--n-500); font-size: .8rem; text-align: center; margin-top: 1.5rem; }

/* --- Хуваарийн хүснэгт --------------------------------------------------- */
.schedule-wrap { border: 1px solid var(--emd-border); border-radius: var(--r-md); background: #fff; overflow: auto; max-height: 75vh; }
.schedule { table-layout: fixed; font-size: .8rem; margin: 0; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.schedule th, .schedule td { border-right: 1px solid var(--n-100); border-bottom: 1px solid var(--n-100); }
.schedule thead th {
  position: sticky; top: 0; z-index: 2; background: var(--n-25);
  text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--emd-slate);
}
.schedule th.time-col, .schedule td.time-col {
  width: 4.25rem; white-space: nowrap; color: var(--n-500);
  position: sticky; left: 0; z-index: 1; background: #fff; text-align: right; padding-right: .6rem;
}
.schedule thead th.time-col { z-index: 3; background: var(--n-25); }
.schedule td.slot { height: 2.1rem; padding: .2rem .4rem; vertical-align: top; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.schedule td.slot-free { cursor: pointer; }
.schedule td.slot-free:hover { background: var(--emd-primary-soft); box-shadow: inset 0 0 0 1px var(--emd-primary-line); }
.schedule td.slot-free:hover::after { content: "+"; color: var(--emd-primary); font-weight: 700; }
.schedule td.slot-booked { background: var(--emd-primary-soft); cursor: pointer; border-left: 3px solid var(--emd-primary); color: var(--bs-primary-text-emphasis); }
.schedule td.slot-booked.slot-mine { background: var(--emd-green-soft); border-left-color: var(--emd-green); color: #1f5e2f; }
.schedule td.slot-closed { background: repeating-linear-gradient(135deg, #f6f8fa, #f6f8fa 6px, #eff3f5 6px, #eff3f5 12px); }
.schedule td.slot-past { background: #eaeff2; }
.schedule th.today { background: #fff7e0; color: #7a5200; }
.schedule .vehicle-col { width: 11rem; position: sticky; left: 0; z-index: 1; background: #fff; }
.schedule thead .vehicle-col { z-index: 3; background: var(--n-25); }
.trip {
  font-size: .75rem; border-radius: .4rem; padding: .25rem .4rem; margin-bottom: .25rem;
  background: var(--emd-primary-soft); border-left: 3px solid var(--emd-primary); white-space: normal;
}
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: var(--n-500); margin-top: .75rem; }
.legend span::before { content: ""; display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; margin-right: .35rem; vertical-align: -.1rem; }
.legend .l-free::before { background: #fff; border: 1px solid var(--emd-border); }
.legend .l-booked::before { background: var(--emd-primary-soft); border-left: 3px solid var(--emd-primary); }
.legend .l-mine::before { background: var(--emd-green-soft); border-left: 3px solid var(--emd-green); }
.legend .l-closed::before { background: repeating-linear-gradient(135deg, #f6f8fa, #f6f8fa 3px, #e3e9ed 3px, #e3e9ed 6px); }
.legend .l-past::before { background: #eaeff2; }

/* Хүснэгтийн толгой дахь өдрийн захиалгын тоо */
.day-count {
  display: inline-block; min-width: 1.2rem; padding: 0 .35rem; margin-left: .25rem;
  border-radius: 1rem; background: var(--emd-primary-soft); color: var(--emd-primary);
  font-size: .68rem; font-weight: 600; line-height: 1.2rem;
}
.schedule th.today .day-count { background: #fff; }

/* --- Сарын жижиг хуанли -------------------------------------------------- */
.mini-cal { user-select: none; }
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.mini-cal-title { font-weight: 600; color: var(--emd-slate); font-size: .9rem; }
.mini-cal-nav {
  width: 30px; height: 30px; border-radius: .5rem; display: inline-flex; align-items: center; justify-content: center;
  color: var(--emd-slate); text-decoration: none;
}
.mini-cal-nav:hover { background: var(--emd-bg); }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-cal-wd { font-size: .68rem; font-weight: 600; color: var(--n-400); padding-bottom: .25rem; }
.mini-cal-day {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; max-height: 40px; border-radius: .5rem;
  font-size: .8rem; color: var(--emd-ink); text-decoration: none; padding-bottom: 4px;
}
.mini-cal-day:hover { background: var(--emd-bg); color: var(--emd-ink); }
.mini-cal-day.out { color: var(--n-300); }
.mini-cal-day.selected { background: var(--emd-primary-soft); color: var(--emd-primary); font-weight: 600; }
.mini-cal-day.today { box-shadow: inset 0 0 0 1.5px var(--emd-primary); font-weight: 700; }
.mini-cal .dot {
  position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--emd-primary);
}
.mini-cal .dot.busy { width: 12px; border-radius: 3px; }
.mini-cal .dot.mine { background: var(--emd-green); }
.mini-cal-legend { display: flex; gap: .9rem; margin-top: .6rem; font-size: .72rem; color: var(--n-500); }
.mini-cal-legend .dot { position: static; transform: none; display: inline-block; margin-right: .3rem; vertical-align: middle; }

/* --- Modal --------------------------------------------------------------- */
.modal-content { border: 0; border-radius: var(--r-lg); }
.modal-header { border-bottom-color: var(--emd-border); }
.modal-header .modal-title { font-weight: 600; }
.modal-footer { border-top-color: var(--emd-border); }
@media (max-width: 575.98px) { .modal-content { border-radius: 0; } }

/* --- Мессеж -------------------------------------------------------------- */
.alert { border-radius: .65rem; }

/* --- Хэвлэх ------------------------------------------------------------- */
@media print {
  .app-topbar, .app-sidebar, .app-footer, .page-head .actions { display: none !important; }
  .app-main { padding: 0; }
}

/* --- Ажлын орчин (Plane маягаар): самбар / жагсаалт / хүснэгт ---------------- */
.app-content.wide { max-width: none; }
.ws-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: .75rem; }
.ws-title-block { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.ws-title-block h1 { font-size: 1.3rem; font-weight: 650; margin: 0; }
.ws-prefix { font-family: var(--font-mono); font-size: .7rem; font-weight: 700; color: var(--n-600); background: var(--n-100); border-radius: 4px; padding: .1rem .4rem; letter-spacing: .03em; }
.ws-controls { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.ws-controls .segmented a { padding: .3rem .6rem; }
.ws-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--n-200); margin-bottom: .75rem; overflow-x: auto; }
.ws-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .75rem; color: var(--n-600); text-decoration: none; font-size: .875rem; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ws-tabs a:hover { color: var(--n-900); }
.ws-tabs a.active { color: var(--emd-primary); border-bottom-color: var(--emd-primary); }
.ws-views { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .6rem; }
.ws-view { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; padding: .2rem .6rem; border-radius: 1rem; color: var(--n-600); text-decoration: none; border: 1px solid transparent; background: transparent; }
.ws-view a { color: inherit; text-decoration: none; }
.ws-view:hover { background: var(--n-100); color: var(--n-900); }
.ws-view.active { background: #fff; border-color: var(--n-200); color: var(--n-900); font-weight: 600; box-shadow: var(--shadow-xs); }
.ws-view-add { border: 1px dashed var(--n-300); }
.ws-view-x { border: 0; background: none; color: var(--n-400); padding: 0 0 0 .15rem; line-height: 1; }
.ws-view-x:hover { color: var(--emd-danger); }
.ws-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .75rem; }
.ws-chip { font-size: .78rem; background: var(--emd-primary-soft); color: var(--n-900); border: 1px solid var(--emd-primary-line); border-radius: 4px; padding: .1rem .5rem; text-decoration: none; }
.ws-chip:hover { border-color: var(--emd-primary); color: var(--emd-danger); }
.ws-filter { width: 300px; }
.ws-filter-body { max-height: 52vh; overflow-y: auto; padding: .25rem .75rem .5rem; }
.ws-filter-body h6 { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--n-500); margin: .7rem 0 .25rem; }
.ws-filter-body label { display: flex; align-items: center; gap: .5rem; font-size: .85rem; padding: .15rem 0; cursor: pointer; }
.ws-display { width: 280px; }
.ws-props-toggle { display: flex; flex-wrap: wrap; gap: .3rem; }
.prop-toggle { font-size: .75rem; border: 1px solid var(--n-200); background: #fff; color: var(--n-500); border-radius: 4px; padding: .15rem .45rem; }
.prop-toggle.on { background: var(--emd-primary-soft); border-color: var(--emd-primary-line); color: var(--emd-primary); font-weight: 600; }

/* Шинж чанарыг нуух (харагдацын тохиргоо) */
.ws.hide-key .p-key, .ws.hide-state .p-state, .ws.hide-priority .p-priority, .ws.hide-assignee .p-assignee,
.ws.hide-due .p-due, .ws.hide-start .p-start, .ws.hide-labels .p-labels, .ws.hide-points .p-points,
.ws.hide-cycle .p-cycle, .ws.hide-module .p-module, .ws.hide-subtasks .p-subtasks { display: none !important; }

/* Төлөв, ач холбогдлын icon */
.state-ico, .prio-ico { flex-shrink: 0; display: inline-block; vertical-align: -2px; }

/* Шинж чанарын «pill» */
.prop-dd { display: inline-flex; position: relative; }
.prop-pill {
  display: inline-flex; align-items: center; gap: .3rem; height: 22px; padding: 0 .4rem; max-width: 190px;
  border: 1px solid var(--n-200); border-radius: 4px; background: #fff; color: var(--n-700);
  font-size: .72rem; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
}
.prop-pill .pl { overflow: hidden; text-overflow: ellipsis; }
.prop-pill .bi { font-size: .78rem; color: var(--n-500); }
.prop-pill:hover:not([disabled]) { background: var(--n-50); border-color: var(--n-300); }
.prop-pill[disabled] { cursor: default; opacity: 1; }
.prop-pill.static { cursor: default; }
.prop-pill.danger { color: var(--emd-danger); border-color: #f3c2c4; background: var(--emd-danger-soft); }
.prop-pill.danger .bi { color: var(--emd-danger); }
.task-card .prop-pill.empty, .ws-row .prop-pill.empty { border-style: dashed; color: var(--n-400); opacity: 0; transition: opacity .12s; }
.task-card:hover .prop-pill.empty, .ws-row:hover .prop-pill.empty, .prop-dd.show .prop-pill.empty { opacity: 1; }
.lbl { display: inline-flex; align-items: center; gap: .25rem; }
.lbl i, .lbl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.avatars { display: inline-flex; }
.av, .avatars .av {
  width: 20px; height: 20px; border-radius: 50%; background: var(--emd-primary); color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 700;
}
.avatars .av + .av { margin-left: -5px; box-shadow: 0 0 0 1.5px #fff; }
.av.more { background: var(--n-300); color: var(--n-700); }
.prop-dd .prop-pill:has(.avatars) { border-color: transparent; padding: 0 .1rem; background: transparent; }

/* Шинж чанарын цэс */
.prop-menu { min-width: 210px; max-height: 340px; overflow-y: auto; padding: .3rem; font-size: .85rem; }
.prop-menu .dropdown-item { gap: .5rem; padding: .35rem .5rem; font-size: .85rem; }
.prop-menu .dropdown-item.active { background: var(--emd-primary-soft); color: var(--n-900); font-weight: 600; }
.prop-menu .dropdown-header { padding: .5rem .5rem .2rem; }
.prop-menu .check { width: 14px; height: 14px; border: 1.5px solid var(--n-300); border-radius: 3px; flex-shrink: 0; position: relative; }
.prop-menu .check.on { background: var(--emd-primary); border-color: var(--emd-primary); }
.prop-menu .check.on::after { content: ""; position: absolute; left: 3.5px; top: 1px; width: 4px; height: 7px; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }

/* Kanban */
.kanban { display: flex; gap: .9rem; overflow-x: auto; padding: .1rem .1rem .75rem; align-items: flex-start; cursor: grab; }
.kanban.panning { cursor: grabbing; user-select: none; }
.kanban .task-card, .kanban button, .kanban a, .kanban input { cursor: pointer; }
.kanban input[type="text"] { cursor: text; }
/* macOS-ийн нуугддаг гүйлгэх мөрийг үргэлж харуулна */
.kanban::-webkit-scrollbar { height: 12px; }
.kanban::-webkit-scrollbar-track { background: var(--n-100); border-radius: 6px; }
.kanban::-webkit-scrollbar-thumb { background: var(--n-400); border-radius: 6px; border: 2px solid var(--n-100); }
.kanban::-webkit-scrollbar-thumb:hover { background: var(--n-500); }
@supports not selector(::-webkit-scrollbar) { .kanban { scrollbar-width: auto; } }
.kanban-col { flex: 0 0 316px; background: var(--n-50); border: 1px solid var(--n-100); border-radius: var(--r-md); padding: .55rem .5rem; max-height: calc(100vh - 320px); min-height: 200px; display: flex; flex-direction: column; }
.kanban-col > header, .ws-group-head { display: flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .85rem; padding: .1rem .3rem .55rem; color: var(--n-900); }
.gh-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-count { color: var(--n-500); font-weight: 500; font-size: .78rem; }
.gh-meta { font-size: .72rem; color: var(--n-500); font-weight: 500; }
.gh-add { border: 0; background: none; color: var(--n-500); width: 22px; height: 22px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.gh-add:hover { background: var(--n-200); color: var(--n-900); }
.kanban-list { min-height: 60px; overflow-y: auto; display: grid; gap: .45rem; align-content: start; padding: 1px; scrollbar-width: thin; }
.task-card {
  background: #fff; border: 1px solid var(--n-200); border-radius: var(--r-sm); padding: .55rem .6rem .5rem; cursor: pointer;
  box-shadow: var(--shadow-xs); transition: box-shadow .12s, border-color .12s;
}
.task-card:hover { border-color: var(--n-300); box-shadow: var(--shadow-sm); }
.task-card.overdue { box-shadow: inset 2px 0 0 #e5484d, var(--shadow-xs); }
.tc-top { display: flex; align-items: center; gap: .4rem; min-height: 16px; }
.tc-key { font-family: var(--font-mono); font-size: .68rem; color: var(--n-500); font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.tc-flag { font-size: .66rem; color: var(--n-500); display: inline-flex; align-items: center; gap: .2rem; }
.tc-flag.blocked { color: #c2410c; background: #fff1e6; border-radius: 3px; padding: 0 .3rem; }
.tc-title { display: block; color: var(--n-900); text-decoration: none; font-weight: 500; font-size: .86rem; line-height: 1.38; margin: .2rem 0 .45rem; word-break: break-word; }
.tc-title:hover { color: var(--emd-primary); }
.tc-props { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.task-ghost { opacity: .4; background: var(--emd-primary-soft); }
.quick-add { display: flex; align-items: center; gap: .4rem; padding: .35rem .45rem; border-radius: var(--r-sm); color: var(--n-500); }
.quick-add input { flex: 1; border: 0; background: transparent; outline: 0; font-size: .85rem; min-width: 0; }
.quick-add:hover, .quick-add:focus-within { background: #fff; box-shadow: inset 0 0 0 1px var(--n-200); }
.quick-add:focus-within { box-shadow: inset 0 0 0 1px var(--emd-primary); color: var(--emd-primary); }

/* Жагсаалт */
.ws-list { border: 1px solid var(--n-200); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.ws-group + .ws-group { border-top: 1px solid var(--n-200); }
.ws-group-head { background: var(--n-50); padding: .45rem .75rem; cursor: pointer; margin: 0; }
.ws-group-head .chev { transition: transform .15s; color: var(--n-500); }
.ws-group.collapsed .ws-group-body { display: none; }
.ws-group.collapsed .chev { transform: rotate(-90deg); }
.ws-row { display: flex; align-items: center; gap: .55rem; padding: .4rem .75rem; border-top: 1px solid var(--n-100); min-height: 40px; cursor: pointer; }
.ws-row:hover { background: var(--n-25); }
.ws-row.overdue { box-shadow: inset 2px 0 0 #e5484d; }
.ws-row .tc-key { min-width: 64px; }
.ws-title { color: var(--n-900); text-decoration: none; font-size: .875rem; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-title:hover { color: var(--emd-primary); }
.ws-props { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.row-add { border-top: 1px solid var(--n-100); border-radius: 0; padding: .45rem .75rem; }
@media (max-width: 991.98px) {
  .ws-row { flex-wrap: wrap; }
  .ws-title { flex-basis: calc(100% - 120px); white-space: normal; }
  .ws-props { flex-wrap: wrap; width: 100%; padding-left: 64px; }
  .ws-props .prop-pill.empty { display: none; }
}

/* Хүснэгт */
.ws-sheet { border: 1px solid var(--n-200); border-radius: var(--r-md); background: #fff; max-height: calc(100vh - 230px); }
.ws-sheet table { font-size: .82rem; }
.ws-sheet thead th { position: sticky; top: 0; z-index: 3; background: var(--n-50); text-transform: none; letter-spacing: 0; font-size: .75rem; color: var(--n-600); border-right: 1px solid var(--n-100); }
.ws-sheet td { border-right: 1px solid var(--n-100); vertical-align: middle; white-space: nowrap; padding: .25rem .4rem; }
.ws-sheet tr:hover td { background: var(--n-25); }
.ws-sheet tr.overdue td:first-child { box-shadow: inset 2px 0 0 #e5484d; }
.ws-sheet .prop-pill { border-color: transparent; background: transparent; }
.ws-sheet .prop-pill:hover:not([disabled]) { border-color: var(--n-200); background: #fff; }
.sheet-sticky { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 78px; }
.sheet-sticky2 { position: sticky; left: 78px; z-index: 2; background: #fff; max-width: 380px; box-shadow: 1px 0 0 var(--n-200); }
.ws-sheet thead .sheet-sticky, .ws-sheet thead .sheet-sticky2 { z-index: 4; background: var(--n-50); }
.ws-sheet .ws-title { display: block; white-space: nowrap; }

/* Peek */
.peek-panel { --bs-offcanvas-width: min(620px, 100vw); border-left: 1px solid var(--n-200); }
.peek { display: flex; flex-direction: column; height: 100%; }
.peek-head { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border-bottom: 1px solid var(--n-200); }
.peek-head .topbar-btn { width: 32px; height: 32px; font-size: 1rem; }
.peek-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem 2rem; }
.peek-title { width: 100%; border: 0; resize: none; font-size: 1.25rem; font-weight: 650; color: var(--n-900); line-height: 1.3; padding: .2rem .3rem; margin: 0 -.3rem .4rem; border-radius: var(--r-sm); overflow: hidden; }
.peek-title:hover { background: var(--n-50); }
.peek-title:focus { outline: 0; box-shadow: 0 0 0 2px var(--bs-focus-ring-color); background: #fff; }
.peek-title-ro { font-size: 1.25rem; font-weight: 650; }
.peek-desc textarea { font-size: .875rem; border-color: transparent; background: var(--n-25); }
.peek-desc textarea:focus { background: #fff; }
.peek-desc-actions { display: none; text-align: right; margin-top: .35rem; }
.peek-desc:focus-within .peek-desc-actions { display: block; }
.peek-props { display: grid; grid-template-columns: 120px 1fr; gap: .35rem .75rem; margin: 1.1rem 0; align-items: center; font-size: .85rem; }
.peek-props dt { font-weight: 500; color: var(--n-500); margin: 0; }
.peek-props dd { margin: 0; min-width: 0; }
.peek-props .prop-pill { border-color: transparent; background: transparent; height: 26px; font-size: .82rem; max-width: 100%; }
.peek-props .prop-pill:hover:not([disabled]) { background: var(--n-100); }
.peek-props .prop-pill.empty { color: var(--n-400); }
.peek-sec { border-top: 1px solid var(--n-100); padding-top: .9rem; margin-top: .9rem; }
.peek-sec h3 { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--n-600); margin-bottom: .5rem; }
.peek-list { list-style: none; padding: 0; margin: 0; }
.peek-list li { display: flex; align-items: center; gap: .45rem; padding: .3rem .25rem; border-radius: var(--r-sm); font-size: .85rem; }
.peek-list li:hover { background: var(--n-50); }
.peek-list a { color: var(--n-900); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peek-list a:hover { color: var(--emd-primary); }
.rel-kind { font-size: .7rem; color: var(--n-600); background: var(--n-100); border-radius: 3px; padding: .05rem .35rem; white-space: nowrap; }
.peek-add { display: flex; align-items: center; gap: .4rem; padding: .3rem .25rem; color: var(--n-500); }
.peek-add input { flex: 1; border: 0; outline: 0; font-size: .85rem; background: transparent; }
.peek-comments { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.peek-comments li { display: flex; gap: .55rem; }
.peek-activity { list-style: none; padding: 0; margin: 0; font-size: .78rem; color: var(--n-700); display: grid; gap: .25rem; }

/* Мөчлөг, модуль */
.ws-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.cycle-card { display: block; background: #fff; border: 1px solid var(--n-200); border-radius: var(--r-md); padding: .85rem 1rem; color: var(--n-900); text-decoration: none; box-shadow: var(--shadow-xs); }
.cycle-card:hover { border-color: var(--emd-primary-line); box-shadow: var(--shadow-sm); color: var(--n-900); }
.cycle-state, .module-state { font-size: .7rem; font-weight: 650; border-radius: 1rem; padding: .1rem .55rem; background: var(--n-100); color: var(--n-600); white-space: nowrap; }
.cycle-state.current, .module-state.s-active { background: #e6f4ea; color: #1f7a3d; }
.cycle-state.upcoming, .module-state.s-planned { background: var(--emd-primary-soft); color: var(--emd-primary); }
.module-state.s-paused { background: var(--emd-warning-soft); color: var(--emd-warning); }
.module-state.s-done { background: #ece8fb; color: #5b3fb0; }
.module-state.s-cancelled { background: var(--emd-danger-soft); color: var(--emd-danger); }

/* Хуучин нэрс (бусад хуудас ашигладаг) */
.points-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem; border-radius: .45rem; background: #efeafb; color: #5b3fb0; font-weight: 700; font-size: .7rem; }
.points-chip.points-sum { background: transparent; border: 1px dashed currentColor; }
.unit-chip { display: inline-block; font-size: .66rem; font-weight: 600; padding: .05rem .45rem; border-radius: 1rem; background: #e8f4f4; color: #23797b; border: 1px solid #cfe7e7; }
.task-key { font-family: var(--font-mono); font-size: .68rem; color: var(--n-400); font-weight: 600; letter-spacing: .02em; }
.tag { display: inline-block; font-size: .68rem; font-weight: 600; padding: .05rem .45rem; border-radius: 1rem;
       color: var(--tag); background: color-mix(in srgb, var(--tag) 14%, white); border: 1px solid color-mix(in srgb, var(--tag) 30%, white); }
.status-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--c, var(--n-400)); flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: .7rem; margin-left: -6px; border: 2px solid #fff; }
.task-description { white-space: normal; line-height: 1.55; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.min-w-0 { min-width: 0; }

/* Түр мэдэгдэл */
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: grid; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.app-toast { background: var(--n-900); color: #fff; padding: .6rem .9rem; border-radius: var(--r-md); box-shadow: var(--shadow-md); font-size: .875rem; transition: opacity .4s, transform .4s; }
.app-toast.t-danger { background: #b4232a; }
.app-toast.t-success { background: #1f7a3d; }
.app-toast.out { opacity: 0; transform: translateY(6px); }


/* --- Хайлт, тушаалын цонх (Ctrl+K) -------------------------------------- */
.palette .modal-dialog { max-width: 600px; margin-top: 10vh; }
.palette .modal-content { box-shadow: var(--shadow-md); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--n-200); }
.palette-input .bi { color: var(--n-500); font-size: 1.1rem; }
.palette-input input { flex: 1; border: 0; outline: 0; font-size: 1rem; background: transparent; }
.palette-list { max-height: 55vh; overflow-y: auto; padding: .4rem; margin: 0; list-style: none; }
.palette-list .grp { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--n-500); padding: .6rem .6rem .25rem; }
.palette-list a { display: flex; align-items: center; gap: .7rem; padding: .5rem .65rem; border-radius: var(--r-sm); color: var(--n-900); text-decoration: none; }
.palette-list a .bi { color: var(--n-500); }
.palette-list a .hint { margin-left: auto; font-size: .75rem; color: var(--n-500); }
.palette-list a.sel { background: var(--emd-primary-soft); color: var(--emd-primary); }
.palette-list a.sel .bi { color: var(--emd-primary); }
.palette-foot { display: flex; gap: 1rem; padding: .5rem 1rem; border-top: 1px solid var(--n-200); background: var(--n-25); font-size: .75rem; color: var(--n-500); }

/* --- Мэдлэгийн сан ------------------------------------------------------- */
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.5rem; align-items: start; }
@media (max-width: 991.98px) { .kb-layout { grid-template-columns: 1fr; } }
.kb-search { position: relative; }
.kb-search .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--n-500); }
.kb-search input { padding-left: 2.4rem; height: 44px; font-size: 1rem; }
.kb-item { display: block; padding: 1rem 1.15rem; border-bottom: 1px solid var(--n-100); color: inherit; text-decoration: none; }
.kb-item:last-child { border-bottom: 0; }
.kb-item:hover { background: var(--n-25); }
.kb-item h3 { font-size: 1rem; font-weight: 650; margin: 0 0 .2rem; color: var(--n-900); }
.kb-item:hover h3 { color: var(--emd-primary); }
.kb-item p { margin: 0 0 .4rem; color: var(--n-600); font-size: .875rem; }
.kb-meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: center; font-size: .78rem; color: var(--n-500); }
.scope { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 650; padding: .1rem .5rem; border-radius: 1rem; }
.scope-PRIVATE { background: var(--n-100); color: var(--n-600); }
.scope-UNIT { background: #e6f4f4; color: #1d6d6f; }
.scope-ORG { background: var(--emd-primary-soft); color: var(--emd-primary); }
.scope-PENDING { background: var(--emd-warning-soft); color: var(--emd-warning); }
.kb-pinned { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kb-pinned a { display: block; padding: .9rem 1rem; border: 1px solid var(--n-200); border-left: 3px solid var(--emd-primary); border-radius: var(--r-md); background: #fff; text-decoration: none; color: inherit; box-shadow: var(--shadow-xs); }
.kb-pinned a:hover { box-shadow: var(--shadow-sm); border-color: var(--emd-primary-line); }
.kb-pinned strong { display: block; color: var(--n-900); font-size: .92rem; }
.kb-side-list { list-style: none; padding: 0; margin: 0; }
.kb-side-list a { display: flex; justify-content: space-between; padding: .35rem .5rem; border-radius: var(--r-sm); color: var(--n-700); text-decoration: none; font-size: .875rem; }
.kb-side-list a:hover { background: var(--n-100); }
.kb-side-list a.active { background: var(--emd-primary-soft); color: var(--emd-primary); font-weight: 600; }
.kb-side-list .n { color: var(--n-500); font-size: .78rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag-cloud a { font-size: .75rem; padding: .15rem .55rem; border-radius: 1rem; background: var(--n-100); color: var(--n-700); text-decoration: none; }
.tag-cloud a:hover, .tag-cloud a.active { background: var(--emd-primary-soft); color: var(--emd-primary); }

/* Нийтлэлийн бичвэр – уншихад тохирсон өргөн, зай */
.prose { font-size: 1rem; line-height: 1.7; color: var(--n-900); max-width: 72ch; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2 { font-size: 1.3rem; font-weight: 650; margin: 1.8rem 0 .7rem; padding-bottom: .3rem; border-bottom: 1px solid var(--n-100); }
.prose h3 { font-size: 1.1rem; font-weight: 650; margin: 1.5rem 0 .5rem; }
.prose h4 { font-size: 1rem; font-weight: 650; margin: 1.2rem 0 .4rem; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote { margin-bottom: 1rem; }
.prose li { margin-bottom: .25rem; }
.prose code { background: var(--n-100); padding: .1rem .35rem; border-radius: 4px; font-size: .88em; color: #a23a62; }
.prose pre { background: var(--n-900); color: #e8edf2; padding: 1rem 1.1rem; border-radius: var(--r-md); overflow-x: auto; font-size: .85rem; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose blockquote { border-left: 3px solid var(--emd-primary-line); padding: .25rem 0 .25rem 1rem; color: var(--n-600); }
.prose table { width: 100%; border-collapse: collapse; font-size: .9rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--n-200); padding: .45rem .65rem; }
.prose th { background: var(--n-25); font-weight: 650; }
.prose img { max-width: 100%; border-radius: var(--r-sm); }
.prose a { text-underline-offset: 2px; }
.kb-editor { font-family: var(--bs-font-monospace); font-size: .9rem; line-height: 1.6; min-height: 380px; }
.kb-preview { min-height: 380px; border: 1px dashed var(--n-300); border-radius: var(--r-sm); padding: 1rem 1.25rem; background: #fff; }
.vis-option { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--n-200); border-radius: var(--r-sm); margin-bottom: .5rem; cursor: pointer; background: #fff; }
.vis-option:hover { border-color: var(--n-300); }
.vis-option:has(input:checked) { border-color: var(--emd-primary); background: var(--emd-primary-soft); }
.vis-option input { margin-top: .25rem; }
.vis-option small { display: block; color: var(--n-500); }

/* --- Төлөвлөгөө: pm.hrs.gov.mn-ийн хүснэгттэй ижил төрх ------------------------ */
.hrs-table { --bs-table-border-color: var(--n-200); font-size: .875rem; }
.hrs-table > thead th { text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--n-700); vertical-align: middle; border: 1px solid var(--n-200); }
.hrs-table > tbody td { border-left: 1px solid var(--n-100); border-right: 1px solid var(--n-100); vertical-align: middle; }
.hrs-group > td { background: var(--n-50) !important; color: var(--n-700); font-size: .85rem; padding-top: .55rem; padding-bottom: .55rem; }
.hrs-row.depth-0 .hrs-title a, .hrs-row.depth-0 .hrs-title { font-weight: 600; }
.hrs-row.depth-1 .hrs-title { padding-left: 1.5rem; }
.hrs-row.depth-2 .hrs-title { padding-left: 3rem; }
.hrs-row.depth-2 > td:first-child { color: var(--n-600); font-weight: 500 !important; }
.hrs-add { border-style: dashed; }
.ind-table td { padding: .3rem .25rem; }

/* Төлөвлөгөөний биелэлт: төлөвлөсөн хурдны тэмдэг (IBCS – гүйцэтгэлийг төлөвлөгөөтэй харьцуулна) */
.progress-expected { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--n-600, #4a5866); }

/* ---- Responsive: утас, таблет ---- */
.page-head .actions .btn { white-space: nowrap; }
.page-head .actions .btn-group { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.task-card:focus-within .prop-pill.empty, .ws-row:focus-within .prop-pill.empty { opacity: 1; }
@media (hover: none) { .task-card .prop-pill.empty, .ws-row .prop-pill.empty { opacity: 1; } }
@media (max-width: 767.98px) {
  .app-main .form-control-sm, .app-main .form-select-sm, .app-main .btn-sm { min-height: 40px; }
  .prop-pill { min-height: 32px; }
  .app-main .form-check-input { width: 1.35em; height: 1.35em; }
  .gh-add { width: 34px; height: 34px; }
  .kanban { scroll-snap-type: x proximity; cursor: auto; }
  .kanban-col { flex-basis: min(316px, 86vw); scroll-snap-align: start; }
  .page-head .actions > .btn-group { flex: 1 1 auto; }
  .page-head .actions > .btn-group > .btn:not([aria-label]) { flex: 1 0 auto; }
}
.review-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: .5rem 1rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--n-200); }
.review-row:last-child { border-bottom: 0; }
@media (max-width: 767.98px) { .review-row { grid-template-columns: 1fr; } }
