/* gh-ui v0.7.0 — Гранд Хабхастурын нэгдсэн дизайн систем (DS-1, ЕП; Ерөнхий менежер Э.Баясгалан 2026-11-25 17:37)
   Нэг эх: өнгө (OKLCH), фонт, зай, гүн, хөдөлгөөн → 5 систем (Удирдлагын төв, Тооно, Bonabid, Tecolum, сайт/Админ төв).
   Аппад өөрчлөлтгүй хуулна (Ш-034): толгойд «/* shared: gh-ui vX.Y.Z · <sha> *\/». Гуравдагч хүсэлт 0, `unsafe-eval` 0.
   Апп: <html data-app="core|toono|bonabid|tecolum|site" data-theme="light|dark|auto"> */

@layer gh.reset, gh.tokens, gh.base, gh.components, gh.motion, gh.utils;

/* ── Фонт (өөрийн серверээс, OFL) ───────────────────────────────────── */
@font-face { font-family: "GH Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+04E8-04E9, U+2116; }
@font-face { font-family: "GH Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AE, U+2190-21FF, U+2212; }
@font-face { font-family: "GH Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+04E8-04E9, U+2116; }
@font-face { font-family: "GH Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AE, U+2190-21FF, U+2212; }
@font-face { font-family: "GH Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+04E8-04E9, U+2116; }
@font-face { font-family: "GH Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AE, U+2190-21FF, U+2212; }
@font-face { font-family: "GH Display"; font-weight: 700; font-display: swap; src: url(fonts/montserrat-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+04E8-04E9, U+2116; }
@font-face { font-family: "GH Display"; font-weight: 700; font-display: swap; src: url(fonts/montserrat-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AE, U+2190-21FF, U+2212; }
@font-face { font-family: "GH Display"; font-weight: 800; font-display: swap; src: url(fonts/montserrat-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+04E8-04E9, U+2116; }
@font-face { font-family: "GH Display"; font-weight: 800; font-display: swap; src: url(fonts/montserrat-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AE, U+2190-21FF, U+2212; }

@layer gh.reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; interpolate-size: allow-keywords; }
  body { margin: 0; }
  img, svg, canvas, video { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  :where(h1, h2, h3, h4, p, figure, ul, ol) { margin: 0; }
}

/* ── Токен ─────────────────────────────────────────────────────────────
   Брэнд: хөх #1D3FA6 ≈ oklch(0.42 0.17 266), алт #F2A516 ≈ oklch(0.78 0.16 75),
   цөцгий #FBF7F0, хар хөх #0F1C46. Апп бүр «accent»-ийн өнгөний өнцгөөрөө (hue) ялгарна. */
@layer gh.tokens {
  :root {
    --gh-hue: 266;            /* апп-ын өнгөний өнцөг */
    --gh-hue-2: 75;           /* хоёрдогч (алт) */
    --gh-blue: oklch(0.42 0.17 266);
    --gh-gold: oklch(0.78 0.16 75);
    --gh-navy: oklch(0.24 0.08 268);
    --gh-cream: oklch(0.975 0.01 85);

    /* гадаргуу — гэрэл */
    --bg: oklch(0.975 0.008 var(--gh-hue));
    --bg-2: oklch(0.955 0.012 var(--gh-hue));
    --surface: oklch(1 0 0 / 0.72);
    --surface-solid: oklch(0.995 0.003 var(--gh-hue));
    --surface-2: oklch(0.97 0.01 var(--gh-hue) / 0.8);
    --line: oklch(0.55 0.04 var(--gh-hue) / 0.16);
    --line-strong: oklch(0.55 0.05 var(--gh-hue) / 0.32);
    --text: oklch(0.22 0.04 var(--gh-hue));
    --text-2: oklch(0.44 0.03 var(--gh-hue));
    --text-3: oklch(0.52 0.025 var(--gh-hue));
    --accent: oklch(0.47 0.19 var(--gh-hue));
    --accent-ink: oklch(0.99 0 0);
    --accent-soft: oklch(0.47 0.19 var(--gh-hue) / 0.12);
    --accent-2: oklch(0.74 0.16 var(--gh-hue-2));
    --ok: oklch(0.47 0.12 150);  --ok-soft: oklch(0.52 0.13 150 / 0.13);
    --warn: oklch(0.5 0.12 65); --warn-soft: oklch(0.75 0.15 75 / 0.18);
    --bad: oklch(0.53 0.19 27);  --bad-soft: oklch(0.53 0.19 27 / 0.12);
    --focus: oklch(0.62 0.2 var(--gh-hue));

    /* шил (Liquid Glass) */
    --glass-blur: 18px;
    --glass-sat: 1.6;
    --glass-edge: inset 0 1px 0 oklch(1 0 0 / 0.75), inset 0 -1px 0 oklch(0.4 0.05 var(--gh-hue) / 0.06);

    /* гүн */
    --shadow-1: 0 1px 2px oklch(0.25 0.06 var(--gh-hue) / 0.08), 0 2px 8px oklch(0.25 0.06 var(--gh-hue) / 0.05);
    --shadow-2: 0 2px 6px oklch(0.25 0.06 var(--gh-hue) / 0.08), 0 12px 32px oklch(0.25 0.06 var(--gh-hue) / 0.10);
    --shadow-3: 0 8px 24px oklch(0.25 0.06 var(--gh-hue) / 0.14), 0 32px 80px oklch(0.25 0.06 var(--gh-hue) / 0.18);

    /* фонт, хэмжээ — шингэн (clamp) */
    --font: "GH Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "GH Display", "GH Inter", system-ui, sans-serif;
    --fs-xs: 0.75rem; --fs-sm: 0.875rem; --fs-md: 1rem; --fs-lg: 1.125rem;
    --fs-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --fs-2xl: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem);
    --fs-hero: clamp(2.2rem, 1.4rem + 4vw, 4.5rem);

    /* зай, булан */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;
    --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --r-xl: 32px; --r-pill: 999px;

    /* хөдөлгөөн — зорилготой, богино */
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.1%, 1);
    --dur-1: 120ms; --dur-2: 220ms; --dur-3: 420ms;

    color-scheme: light dark;
  }

  /* Апп бүрийн өнгө (нэг брэнд — өөр өнгөний өнцөг) */
  [data-app="core"]    { --gh-hue: 266; --gh-hue-2: 75; }   /* Удирдлагын төв — брэндийн хөх */
  [data-app="toono"]   { --gh-hue: 232; --gh-hue-2: 75; }   /* Тооно — тэнгэрийн хөх + алт */
  [data-app="bonabid"] { --gh-hue: 200; --gh-hue-2: 75; }   /* Bonabid — тунгалаг цэнхэр */
  [data-app="tecolum"] { --gh-hue: 150; --gh-hue-2: 60; }   /* Tecolum — аюулгүй байдлын ногоон + улбар */
  [data-app="site"]    { --gh-hue: 266; --gh-hue-2: 75; }
  [data-app="fincolum"] { --gh-hue: 318; --gh-hue-2: 75; }  /* Fincolum — санхүү: гүн нил ягаан + алт (v0.7.0; бусад апп-аас ≥ 52°) */

  /* Бараан */
  [data-theme="dark"] {
    --bg: oklch(0.17 0.03 var(--gh-hue));
    --bg-2: oklch(0.2 0.035 var(--gh-hue));
    --surface: oklch(0.25 0.035 var(--gh-hue) / 0.62);
    --surface-solid: oklch(0.23 0.035 var(--gh-hue));
    --surface-2: oklch(0.3 0.04 var(--gh-hue) / 0.55);
    --line: oklch(0.85 0.03 var(--gh-hue) / 0.12);
    --line-strong: oklch(0.85 0.03 var(--gh-hue) / 0.24);
    --text: oklch(0.96 0.01 var(--gh-hue));
    --text-2: oklch(0.8 0.02 var(--gh-hue));
    --text-3: oklch(0.7 0.02 var(--gh-hue));
    --accent: oklch(0.76 0.14 var(--gh-hue));
    --accent-ink: oklch(0.18 0.04 var(--gh-hue));
    --accent-soft: oklch(0.76 0.14 var(--gh-hue) / 0.16);
    --accent-2: oklch(0.82 0.15 var(--gh-hue-2));
    --ok: oklch(0.78 0.14 150); --warn: oklch(0.82 0.14 75); --bad: oklch(0.74 0.16 27);
    --glass-edge: inset 0 1px 0 oklch(1 0 0 / 0.12), inset 0 -1px 0 oklch(0 0 0 / 0.25);
    --shadow-1: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-2: 0 2px 6px oklch(0 0 0 / 0.3), 0 12px 32px oklch(0 0 0 / 0.35);
    --shadow-3: 0 8px 24px oklch(0 0 0 / 0.4), 0 32px 80px oklch(0 0 0 / 0.5);
  }
  @media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
      --bg: oklch(0.17 0.03 var(--gh-hue)); --bg-2: oklch(0.2 0.035 var(--gh-hue));
      --surface: oklch(0.25 0.035 var(--gh-hue) / 0.62); --surface-solid: oklch(0.23 0.035 var(--gh-hue));
      --surface-2: oklch(0.3 0.04 var(--gh-hue) / 0.55);
      --line: oklch(0.85 0.03 var(--gh-hue) / 0.12); --line-strong: oklch(0.85 0.03 var(--gh-hue) / 0.24);
      --text: oklch(0.96 0.01 var(--gh-hue)); --text-2: oklch(0.8 0.02 var(--gh-hue)); --text-3: oklch(0.7 0.02 var(--gh-hue));
      --accent: oklch(0.76 0.14 var(--gh-hue)); --accent-ink: oklch(0.18 0.04 var(--gh-hue));
      --accent-soft: oklch(0.76 0.14 var(--gh-hue) / 0.16); --accent-2: oklch(0.82 0.15 var(--gh-hue-2));
      --ok: oklch(0.78 0.14 150); --warn: oklch(0.82 0.14 75); --bad: oklch(0.74 0.16 27);
      --glass-edge: inset 0 1px 0 oklch(1 0 0 / 0.12), inset 0 -1px 0 oklch(0 0 0 / 0.25);
      --shadow-2: 0 2px 6px oklch(0 0 0 / 0.3), 0 12px 32px oklch(0 0 0 / 0.35);
      --shadow-3: 0 8px 24px oklch(0 0 0 / 0.4), 0 32px 80px oklch(0 0 0 / 0.5);
    }
  }
  /* Өндөр тодрол (хэрэглэгчийн тохиргоо) */
  @media (prefers-contrast: more) {
    :root { --line: var(--line-strong); --text-2: var(--text); --text-3: var(--text-2); --glass-blur: 0px; }
  }
}

@layer gh.base {
  html { background: var(--bg); color: var(--text); font: 400 calc(1rem * var(--gh-text, 1) * var(--gh-calm, 1))/1.55 var(--font); font-feature-settings: "cv11", "ss01", "tnum" 0; }
  body { min-height: 100dvh; background:
      radial-gradient(1200px 600px at 10% -10%, oklch(0.75 0.12 var(--gh-hue) / 0.22), transparent 60%),
      radial-gradient(900px 500px at 100% 0%, oklch(0.85 0.12 var(--gh-hue-2) / 0.18), transparent 60%),
      var(--bg);
    background-attachment: fixed; }
  :where(h1, h2, h3) { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.12; text-wrap: balance; }
  h1 { font-size: var(--fs-2xl); font-weight: 800; }
  h2 { font-size: var(--fs-xl); font-weight: 700; }
  h3 { font-size: var(--fs-lg); font-weight: 700; }
  p { text-wrap: pretty; }
  a { color: var(--accent); text-underline-offset: 3px; }
  ::selection { background: var(--accent-soft); }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
  .num, [data-num] { font-variant-numeric: tabular-nums; }
}

@layer gh.components {
  /* ── Шилэн гадаргуу ── */
  .gh-glass {
    background: var(--surface);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    box-shadow: var(--glass-edge), var(--shadow-2);
    border: 1px solid var(--line);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .gh-glass { background: var(--surface-solid); } }

  /* ── Карт (гэрлийн туяа — хулганы байрлалаар) ── */
  .gh-card {
    position: relative; isolation: isolate; border-radius: var(--r-lg); padding: var(--sp-5);
    background: var(--surface); border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    box-shadow: var(--glass-edge), var(--shadow-1);
    transition: box-shadow var(--dur-2) var(--ease-out), translate var(--dur-2) var(--ease-out), border-color var(--dur-2);
    container-type: inline-size;
  }
  .gh-card::before {   /* туяа */
    content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none; opacity: 0;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), oklch(0.8 0.12 var(--gh-hue) / 0.18), transparent 45%);
    transition: opacity var(--dur-2);
  }
  .gh-card::after {    /* ирмэгийн гэрэл */
    content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px; opacity: 0;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), oklch(0.7 0.18 var(--gh-hue) / 0.7), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
    transition: opacity var(--dur-2);
  }
  .gh-card:hover::before, .gh-card:hover::after, .gh-card:focus-within::after { opacity: 1; }
  .gh-card[data-lift]:hover { translate: 0 -2px; box-shadow: var(--glass-edge), var(--shadow-2); }
  .gh-card > h3 { margin-bottom: var(--sp-2); }

  /* ── Bento сүлжээ ── */
  .gh-bento { display: grid; gap: var(--sp-4); grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .gh-bento > * { grid-column: span 12; min-width: 0; }
  @media (min-width: 720px) {
    .gh-bento > .s3 { grid-column: span 6; } .gh-bento > .s4 { grid-column: span 6; } .gh-bento > .s6 { grid-column: span 12; }
    .gh-bento > .s8 { grid-column: span 12; } .gh-bento > .s12 { grid-column: span 12; }
  }
  @media (min-width: 1100px) {
    .gh-bento > .s3 { grid-column: span 3; } .gh-bento > .s4 { grid-column: span 4; } .gh-bento > .s6 { grid-column: span 6; } .gh-bento > .s8 { grid-column: span 8; }
    .gh-bento > .r2 { grid-row: span 2; }
  }

  /* ── KPI ── */
  .gh-kpi { display: grid; gap: var(--sp-2); }
  .gh-kpi .label { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: var(--sp-2); }
  .gh-kpi .value { font: 800 clamp(1.6rem, 1.2rem + 2cqi, 2.4rem)/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
  .gh-kpi .delta { font-size: var(--fs-sm); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: var(--r-pill); width: fit-content; }
  .gh-kpi .delta.up { color: var(--ok); background: var(--ok-soft); } .gh-kpi .delta.down { color: var(--bad); background: var(--bad-soft); }
  .gh-spark { width: 100%; height: 44px; overflow: visible; }
  .gh-spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .gh-spark path.area { fill: url(#gh-spark-fill); opacity: .9; }

  /* ── Товч ── */
  .gh-btn {
    --b-bg: var(--surface-2); --b-fg: var(--text);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-4);
    border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--b-bg); color: var(--b-fg); font-weight: 600; cursor: pointer;
    box-shadow: var(--glass-edge); transition: transform var(--dur-1) var(--ease-out), background var(--dur-2), box-shadow var(--dur-2);
    text-decoration: none; -webkit-tap-highlight-color: transparent;
  }
  .gh-btn[hidden] { display: none; }
  .gh-btn:hover { background: color-mix(in oklch, var(--b-bg), var(--accent) 8%); }
  .gh-btn:active { transform: scale(0.97); }
  .gh-btn.primary { --b-bg: var(--accent); --b-fg: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 20px oklch(0.47 0.19 var(--gh-hue) / 0.35), inset 0 1px 0 oklch(1 0 0 / 0.25); }
  .gh-btn.primary:hover { background: color-mix(in oklch, var(--accent), white 8%); }
  .gh-btn.ghost { --b-bg: transparent; border-color: transparent; box-shadow: none; }
  .gh-btn.icon { width: 44px; padding: 0; }
  .gh-kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--text-2); background: var(--surface-2); }

  /* ── Хэсэглэсэн сонголт (segmented) ── */
  .gh-seg { width: fit-content; max-width: 100%; flex-wrap: wrap; display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); position: relative; }
  .gh-seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: var(--r-pill); cursor: pointer; font-weight: 600; color: var(--text-2); min-height: 36px; position: relative; z-index: 1; transition: color var(--dur-2); }
  .gh-seg button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); box-shadow: 0 4px 14px oklch(0.47 0.19 var(--gh-hue) / 0.3); }

  /* ── Тэмдэг (badge) ── */
  .gh-badge { width: fit-content; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); }
  .gh-badge.ok { background: var(--ok-soft); color: var(--ok); } .gh-badge.warn { background: var(--warn-soft); color: var(--warn); } .gh-badge.bad { background: var(--bad-soft); color: var(--bad); }
  .gh-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in oklch, currentColor, transparent 80%); }

  /* ── Хүснэгт ── */
  .gh-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
  .gh-table th { text-align: left; font-weight: 600; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-solid); }
  .gh-table td { padding: 12px; border-bottom: 1px solid var(--line); }
  .gh-table tbody tr { transition: background var(--dur-1); }
  .gh-table tbody tr:hover { background: var(--accent-soft); }
  .gh-table .r { text-align: right; font-variant-numeric: tabular-nums; }
  .gh-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Маягт ── */
  .gh-field { display: grid; gap: 6px; }
  .gh-field label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
  .gh-input { min-height: 44px; padding: 0 var(--sp-3); border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); transition: border-color var(--dur-2), box-shadow var(--dur-2); width: 100%; }
  .gh-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

  /* ── Дээд мөр, навигаци ── */
  .gh-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .gh-top .brand { display: flex; align-items: center; gap: var(--sp-2); font: 800 var(--fs-lg)/1 var(--font-display); letter-spacing: -0.02em; margin-right: auto; }
  /* Хайлтын мөр — GHUI.search (v0.6.0, ХМ-1): толгойд харагдана, дарахад Ctrl+K цонх; утсанд (≤ 640 px) дүрс товч 44 px */
  .gh-search { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; min-width: 0; width: clamp(180px, 28vw, 320px); padding: 0 var(--sp-2) 0 var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; transition: border-color var(--dur-1), background-color var(--dur-1); }
  .gh-search:hover { border-color: var(--accent); background: var(--surface-solid); }
  .gh-search:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  .gh-search > svg { flex: none; color: var(--text-2); }
  .gh-search span.t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gh-search .gh-kbd { flex: none; margin-left: auto; }
  @media (max-width: 640px) {
    .gh-search { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; }
    .gh-search span.t, .gh-search .gh-kbd { display: none; }
  }

  /* ── Командын цонх (Ctrl+K) ── */
  .gh-cmd { width: min(640px, calc(100vw - 24px)); margin: 10vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--r-xl); color: var(--text); overflow: hidden; }
  .gh-cmd::backdrop { background: oklch(0.2 0.05 var(--gh-hue) / 0.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .gh-cmd .q { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
  .gh-cmd .q input { flex: 1; border: 0; background: transparent; outline: none; font-size: var(--fs-lg); min-width: 0; }
  .gh-cmd ul { list-style: none; padding: var(--sp-2); margin: 0; max-height: min(52vh, 420px); overflow: auto; }
  .gh-cmd li { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; }
  .gh-cmd li[aria-selected="true"] { background: var(--accent-soft); }
  .gh-cmd li .g { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
  .gh-cmd li mark { background: none; color: var(--accent); font-weight: 700; }
  .gh-cmd .empty { padding: var(--sp-5); color: var(--text-2); text-align: center; }
  .gh-cmd .empty.busy { padding: var(--sp-3); font-size: var(--fs-sm); }
  .gh-cmd li.grp { display: block; padding: var(--sp-3) 12px 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); cursor: default; }
  .gh-cmd li.err { padding: 6px 12px 10px; font-size: var(--fs-sm); color: var(--bad); cursor: default; }
  .gh-cmd li.hit > svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
  .gh-cmd li .t { display: grid; gap: 1px; min-width: 0; }
  .gh-cmd li .tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gh-cmd li .sub { font-size: var(--fs-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gh-cmd li[role="option"] { min-height: 44px; box-sizing: border-box; }
  @media (max-width: 640px) { .gh-cmd { margin-top: 12px; } .gh-cmd ul { max-height: min(62vh, 520px); } }

  /* ── Туслах (AI) — сонголтоор, хүн шийднэ ── */
  .gh-assist { position: fixed; inset: auto 16px 16px auto; width: min(380px, calc(100vw - 32px)); border-radius: var(--r-xl); padding: var(--sp-4); z-index: 30; display: grid; gap: var(--sp-3); }
  .gh-assist[hidden] { display: none; }
  .gh-assist .chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-pill); padding: 8px 12px; text-align: left; cursor: pointer; }

  /* ── Мэдэгдэл (toast) ── */
  .gh-toasts { position: fixed; inset: auto 0 16px 0; display: grid; justify-items: center; gap: 8px; z-index: 50; pointer-events: none; }
  .gh-toast { pointer-events: auto; padding: 12px 16px; border-radius: var(--r-pill); display: flex; gap: 10px; align-items: center; font-weight: 600; }

  /* ── Ачаалж буй (skeleton) ── */
  .gh-skel { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2), color-mix(in oklch, var(--surface-2), var(--accent) 10%), var(--surface-2)); background-size: 200% 100%; animation: gh-shimmer 1.4s linear infinite; }

  /* ── Явцын цагираг ── */
  .gh-ring { --p: 0; width: 120px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-soft) 0); mask: radial-gradient(farthest-side, transparent 72%, #000 73%); }
  .gh-ring-wrap { position: relative; width: 120px; aspect-ratio: 1; display: grid; place-items: center; }
  .gh-ring-wrap > b { position: absolute; font: 800 1.6rem/1 var(--font-display); }

  /* ── Аврора дэвсгэр (hero) ── */
  .gh-aurora { position: absolute; inset: -20%; z-index: -1; pointer-events: none; filter: blur(60px); opacity: .7;
    background: conic-gradient(from var(--gh-aurora-a, 0deg) at 50% 50%, oklch(0.72 0.16 var(--gh-hue) / .6), oklch(0.85 0.14 var(--gh-hue-2) / .5), oklch(0.7 0.14 calc(var(--gh-hue) + 40) / .5), oklch(0.72 0.16 var(--gh-hue) / .6)); }

  /* ── Хоосон төлөв ── */
  .gh-empty { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--text-2); display: grid; gap: var(--sp-3); justify-items: center; }
}

@layer gh.components {
  /* ── Файл харагч ── */
  .gh-viewer { position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--text); display: none; }
  .gh-viewer[open] { display: grid; grid-template: auto minmax(0, 1fr) / minmax(0, 1fr); }
  .gh-viewer::backdrop { background: oklch(0.2 0.05 var(--gh-hue) / 0.5); }
  .gh-viewer-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); border-radius: 0; border-width: 0 0 1px; padding-top: max(var(--sp-2), env(safe-area-inset-top)); }
  .gh-viewer-head .t { display: grid; min-width: 0; margin-right: auto; }
  .gh-viewer-head .t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gh-viewer-body { min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: auto; padding: var(--sp-3); }
  .gh-viewer-body.zoom { place-items: start; }
  .gh-viewer-frame { width: 100%; height: 100%; border: 0; border-radius: var(--r-md); background: #fff; }
  .gh-viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; border-radius: var(--r-sm); background: repeating-conic-gradient(oklch(0.9 0 0) 0 25%, oklch(1 0 0) 0 50%) 50% / 16px 16px; }
  .gh-viewer-img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
  video.gh-viewer-img { cursor: auto; }
  .gh-viewer-text { width: min(1000px, 100%); height: 100%; margin: 0; overflow: auto; padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-solid); border: 1px solid var(--line); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
  @media (max-width: 640px) { .gh-viewer-head .gh-btn:not(.icon) { padding: 0 var(--sp-3); } }
}

@layer gh.components {
  /* ── Хяналтын самбарын нүд — .gh-metric (v0.2.0, DS-1.6; ПД) ──
     Гарчиг (хугацаа + суурьтай) · том утга · жижиг мөр · ⓘ тодорхойлолт (толь gh:metrics.v1) ·
     төлөв = өнгө + дүрс + үг · «өгөгдөл алга» (0 биш) · «урьдчилсан тооцоо» · «< 3» · дарахад шүүлттэй холбоос. */
  .gh-metric { position: relative; display: grid; gap: var(--sp-2); align-content: start; container-type: inline-size; }
  .gh-metric-head { display: flex; align-items: flex-start; gap: var(--sp-2); min-height: 28px; }
  .gh-metric-title { margin: 0 auto 0 0; font: 600 var(--fs-sm)/1.35 var(--font); color: var(--text-2); }
  .gh-metric-info { position: relative; z-index: 2; flex: none; inline-size: 44px; block-size: 44px; margin: -8px -10px -8px 0; padding: 0; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: var(--text-2); font: 700 13px/1 var(--font); }
  .gh-metric-info::before { content: ""; position: absolute; inset: 8px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface-solid); z-index: -1; transition: background var(--dur-1), border-color var(--dur-1); }
  .gh-metric-info:hover::before { border-color: var(--accent); }
  .gh-metric-info[aria-expanded="true"] { color: var(--accent); }
  .gh-metric-info[aria-expanded="true"]::before { background: var(--accent-soft); border-color: var(--accent); }
  .gh-metric-info:focus-visible { outline: none; } .gh-metric-info:focus-visible::before { outline: 2px solid var(--focus); outline-offset: 2px; }
  .gh-metric-def { position: relative; z-index: 2; margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-solid); border: 1px solid var(--line); font-size: var(--fs-sm); line-height: 1.45; color: var(--text); }
  .gh-metric-def[hidden] { display: none; }
  .gh-metric-value { font: 800 clamp(1.6rem, 1.2rem + 2cqi, 2.4rem)/1.05 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
  .gh-metric-value .u { margin-left: .12em; font-size: .55em; font-weight: 700; letter-spacing: 0; color: var(--text-2); }
  .gh-metric-value.neg { color: var(--bad); }
  .gh-metric-value.neg .u { color: inherit; }
  .gh-metric.is-empty .gh-metric-value { font: 600 var(--fs-lg)/1.3 var(--font); letter-spacing: 0; color: var(--text-2); }
  .gh-metric-sub { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
  .gh-metric-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); }
  .gh-metric-state { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 3px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--accent-soft); color: var(--accent); }
  [data-state="ok"]   > .gh-metric-foot .gh-metric-state { background: var(--ok-soft);   color: var(--ok); }
  [data-state="warn"] > .gh-metric-foot .gh-metric-state { background: var(--warn-soft); color: var(--warn); }
  [data-state="bad"]  > .gh-metric-foot .gh-metric-state { background: var(--bad-soft);  color: var(--bad); }
  .gh-metric[data-state="warn"], .gh-metric[data-state="bad"] { border-inline-start: 4px solid var(--warn); }
  .gh-metric[data-state="bad"] { border-inline-start-color: var(--bad); }
  .gh-metric-flag { display: inline-flex; width: fit-content; padding: 2px 9px; border-radius: var(--r-pill); border: 1px dashed var(--line-strong); font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
  .gh-metric-link { margin-left: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--accent); text-decoration: none; }
  .gh-metric-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }   /* бүх нүд дарагдана */
  .gh-metric:has(.gh-metric-link) { cursor: pointer; }
  .gh-metric:has(.gh-metric-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
  .gh-metric-link:focus-visible { outline: none; }
  @media (prefers-contrast: more) { .gh-metric-state, .gh-metric-flag { border: 1px solid currentColor; } }

  /* ── Нүдний бүлэг — .gh-metric-group (v0.2.1): гарчиг + асуудлын тоо, бүлэг бүр тусдаа тор ── */
  .gh-metric-group { display: grid; gap: var(--sp-3); }
  .gh-metric-group + .gh-metric-group { margin-top: var(--sp-5); }
  .gh-metric-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .gh-metric-group-head h2 { font-size: var(--fs-lg); }
  .gh-metric-group-count { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; }
  .gh-metric-group-count.warn { background: var(--warn-soft); color: var(--warn); }
  .gh-metric-group-count.bad  { background: var(--bad-soft);  color: var(--bad); }
}

@layer gh.components {
  /* ── Процессын урсгал — .gh-flow / GHUI.flow (v0.3.0, ПР-1.2 / DS-1.8; ПД) ──
     gh:process.v1-ийн нэг процесс: алхам (дугаар, нэр, гүйцэтгэгч, хугацаа), төрөл (батлалт ✓, шийдвэр — салаа),
     «одоо энд», эрсдэл / хэмжүүр. Босоо (утас) ↔ хэвтээ (өргөн ≥ 900 px). Бичвэр зөвхөн textContent. */
  .gh-flow { display: grid; gap: var(--sp-4); container-type: inline-size; }
  .gh-flow-head { display: grid; gap: var(--sp-2); }
  .gh-flow-head h3 { font-size: var(--fs-xl); }
  .gh-flow-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); color: var(--text-2); }
  .gh-flow-purpose { color: var(--text-2); font-size: var(--fs-sm); max-width: 72ch; }
  .gh-flow-chip { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
  .gh-flow-chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
  .gh-flow-chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
  .gh-flow-chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
  .gh-flow-chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

  .gh-flow-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
  .gh-flow-step { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: var(--sp-3); padding-bottom: var(--sp-4); outline: none; }
  .gh-flow-step::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: 0; width: 2px; background: var(--line-strong); }   /* холбох шугам */
  .gh-flow-step:last-child::before { display: none; }
  .gh-flow-mark { position: relative; z-index: 1; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font: 800 var(--fs-md)/1 var(--font-display); background: var(--surface-solid); color: var(--text); border: 2px solid var(--line-strong); }
  [data-kind="approval"] > .gh-flow-mark { border-color: var(--ok); color: var(--ok); }
  [data-kind="decision"] > .gh-flow-mark { border-radius: 10px; rotate: 45deg; width: 34px; height: 34px; margin: 5px; border-color: var(--warn); }
  [data-kind="decision"] > .gh-flow-mark > span { rotate: -45deg; color: var(--warn); }
  [data-kind="system"] > .gh-flow-mark { border-radius: 10px; }
  [data-kind="wait"] > .gh-flow-mark { border-style: dashed; }
  .gh-flow-step[aria-current="step"] > .gh-flow-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 5px var(--accent-soft); }
  .gh-flow-step[aria-current="step"][data-kind="decision"] > .gh-flow-mark > span { color: var(--accent-ink); }
  .gh-flow-body { min-width: 0; display: grid; gap: 6px; align-content: start; justify-items: start; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); border: 1px solid transparent; transition: background var(--dur-1), border-color var(--dur-1); }
  .gh-flow-step:focus-visible > .gh-flow-body { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
  .gh-flow-step[aria-current="step"] > .gh-flow-body { background: var(--accent-soft); border-color: transparent; }
  .gh-flow-name { font-weight: 700; line-height: 1.3; }
  .gh-flow-row { display: flex; flex-wrap: wrap; gap: 6px var(--sp-2); align-items: center; font-size: var(--fs-sm); color: var(--text-2); }
  .gh-flow-actor { display: inline-flex; align-items: center; gap: 5px; }
  .gh-flow-actor svg { width: 16px; height: 16px; flex: none; }
  .gh-flow-now { background: var(--accent); color: var(--accent-ink); }
  .gh-flow-branch { display: flex; flex-wrap: wrap; gap: 6px; }
  .gh-flow-more { justify-self: stretch; }
  .gh-flow-go { border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); border-radius: var(--r-sm); padding: 5px 10px; text-align: left; line-height: 1.3; min-height: 32px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
  .gh-flow-go:hover { border-color: var(--accent); }
  .gh-flow-note { font-size: var(--fs-xs); color: var(--text-2); }
  .gh-flow-tools { display: flex; flex-wrap: wrap; gap: 6px; }
  .gh-flow-more { display: none; margin: 0; padding: var(--sp-2) var(--sp-3); list-style: none; border-radius: var(--r-sm); background: var(--surface-solid); border: 1px solid var(--line); font-size: var(--fs-sm); }
  .gh-flow-more.open { display: grid; gap: 6px; }
  .gh-flow-more li { display: grid; gap: 2px; }

  /* ── «Замын зураг» — .gh-map (v0.4.0, ПР-1.8.7; ПД) ──
     Эгнээ = мөр (гүйцэтгэгч), урсгал зүүнээс баруун. Нэрийн багана бэхлэгдсэн, зураг дотроо хэвтээ гүйлгэнэ. */
  .gh-flow-head .gh-flow-views { margin-top: var(--sp-1); }
  .gh-flow-views button { min-height: 40px; }
  .gh-flow[data-view="map"] > .gh-flow-steps { display: none !important; }
  .gh-flow[data-view="steps"] > .gh-map { display: none; }
  .gh-vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .gh-map { display: grid; gap: var(--sp-3); min-width: 0; }
  .gh-map-hint { margin: 0; }
  .gh-map-scroll { overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-solid); }
  .gh-map-inner { display: flex; width: max-content; }
  .gh-map-names { position: sticky; left: 0; z-index: 3; flex: none; width: 132px; background: var(--surface-solid); border-right: 1px solid var(--line-strong); box-shadow: 6px 0 12px -8px oklch(0 0 0 / 0.25); }
  .gh-map-lane { box-sizing: border-box; height: 116px; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; color: var(--text); border-bottom: 1px solid var(--line); overflow: hidden; }
  .gh-map-lane:nth-child(even) { background: var(--surface-2); }
  .gh-map-lane:last-child { border-bottom: 0; }
  .gh-map-lane svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
  .gh-map-lane span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .gh-map-canvas { position: relative; flex: none; }
  .gh-map-svg { position: absolute; inset: 0; display: block; overflow: visible; }
  .gh-map-band { fill: transparent; } .gh-map-band.alt { fill: var(--surface-2); }
  .gh-map-edge { fill: none; stroke: var(--text-2); stroke-width: 1.6; }
  .gh-map-edge.back { stroke: var(--warn); stroke-dasharray: 6 4; }
  .gh-map-ah { fill: var(--text-2); }
  .gh-map-lbl { font: 600 11px/1 var(--font-body, system-ui), system-ui, sans-serif; fill: var(--text-2); paint-order: stroke; stroke: var(--surface-solid); stroke-width: 4px; stroke-linejoin: round; }
  .gh-map-lblbg { fill: var(--surface-solid); opacity: .94; }
  .gh-map-term { fill: var(--surface-solid); stroke: var(--text-2); stroke-width: 1.6; }
  .gh-map-term.end { stroke-width: 3; }
  .gh-map-termt { font: 700 11px/1 var(--font-body, system-ui), system-ui, sans-serif; fill: var(--text); }
  .gh-map-node { position: absolute; z-index: 1; box-sizing: border-box; display: flex; align-items: center; gap: 7px; padding: 6px 10px 6px 7px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface-solid); color: var(--text); font-family: inherit; font-size: var(--fs-xs); font-weight: 600; line-height: 1.25; text-align: left; cursor: pointer; box-shadow: 0 1px 2px oklch(0 0 0 / 0.08); transition: border-color var(--dur-1), box-shadow var(--dur-1); }
  .gh-map-node:hover { border-color: var(--accent); }
  .gh-map-node:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  .gh-map-node.is-sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .gh-map-n { flex: none; min-width: 22px; height: 22px; padding: 0 4px; box-sizing: border-box; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line-strong); font: 800 11px/1 var(--font-display); color: var(--text); }
  .gh-map-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .gh-map-node[data-kind="system"] { border-radius: 3px; background: var(--surface-2); }
  .gh-map-node[data-kind="approval"] { border-color: var(--ok); }
  .gh-map-node[data-kind="wait"], .gh-map-node[data-kind="handoff"] { border-style: dashed; }
  .gh-map-badge { position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; font: 800 12px/1 var(--font-body, system-ui), system-ui; background: var(--surface-solid); border: 1.5px solid var(--line-strong); color: var(--text); }
  .gh-map-badge.ok { background: var(--ok); border-color: var(--ok); color: var(--surface-solid); }
  .gh-map-badge.wait::before { content: ""; width: 9px; height: 9px; box-sizing: border-box; border: 2px solid currentColor; border-radius: 50%; background: linear-gradient(currentColor, currentColor) 50% 0 / 2px 50% no-repeat; }   /* цаг */
  /* Шийдвэр — ромбо (хүрээ ба дотор — 2 давхар clip-path) */
  .gh-map-node[data-kind="decision"] { border: 0; border-radius: 0; background: none; box-shadow: none; justify-content: center; flex-direction: column; gap: 3px; padding: 12px 32px; text-align: center; isolation: isolate; }
  .gh-map-node[data-kind="decision"]::before, .gh-map-node[data-kind="decision"]::after { content: ""; position: absolute; z-index: -1; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
  .gh-map-node[data-kind="decision"]::before { inset: 0; background: var(--warn); }
  .gh-map-node[data-kind="decision"]::after { inset: 2.5px 3.5px; background: var(--surface-solid); }
  .gh-map-node[data-kind="decision"] .gh-map-t { -webkit-line-clamp: 3; font-size: 11px; line-height: 1.2; }
  .gh-map-node[data-kind="decision"] .gh-map-n { min-width: 20px; height: 20px; border-color: var(--warn); }
  .gh-map-node[data-kind="decision"].is-sel::before, .gh-map-node[data-kind="decision"]:hover::before { background: var(--accent); }
  .gh-map-node[aria-current="step"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .gh-map-node[aria-current="step"] .gh-map-n { background: var(--accent-ink); color: var(--accent); border-color: transparent; }
  .gh-map-node[data-kind="decision"][aria-current="step"] { background: none; }
  .gh-map-node[data-kind="decision"][aria-current="step"]::after { background: var(--accent); }
  .gh-map-detail { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-md); background: var(--accent-soft); }
  .gh-map-detail[hidden] { display: none; }
  .gh-map-dn { font: 800 var(--fs-lg)/1.2 var(--font-display); color: var(--accent); padding-top: var(--sp-2); }
  .gh-map-print { display: none; }
  @media (max-width: 560px) { .gh-map-names { width: 92px; } .gh-map-lane { padding: 0 6px; font-size: 11px; } .gh-map-lane svg { display: none; } }
  @media (prefers-reduced-motion: reduce) { .gh-map-node { transition: none; } }
  [data-mode="calm"] .gh-map-node { box-shadow: none; }
  @page gh-map { size: A4 landscape; margin: 10mm; }
  @media print {
    .gh-flow-views, .gh-map-hint { display: none !important; }
    .gh-flow[data-view="map"] { page: gh-map; }
    .gh-map > .gh-map-scroll { display: none; }
    .gh-map-print { display: grid; gap: 0; }
    .gh-map-page { break-inside: avoid; }
    .gh-map-page + .gh-map-page { break-before: page; }
    .gh-map-page .gh-map-names { position: static; box-shadow: none; }
    .gh-map-vp { position: relative; overflow: hidden; flex: none; }
    .gh-map-pno { font-size: 11px; color: var(--text-2); text-align: right; }
    .gh-map-scroll, .gh-map-page .gh-map-inner { border: 1px solid #999; }
    .gh-map-node, .gh-map-band, .gh-map-lane, .gh-map-badge, .gh-map-node::before, .gh-map-node::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  }

  /* ── Сонголтын мөр — .gh-choice (v0.5.0, ТС-1 Ш-4; ПД) ──
     Мөр бүхэлдээ дарагдана (жинхэнэ <input> мөрийг бүрхэнэ — гар, дэлгэц уншигч хэвээр). Бүх сонголт ижил жинтэй: сонгосон нь л хүрээ + цэгээр ялгарна. */
  .gh-choices { display: grid; gap: var(--sp-2); margin: 0; padding: 0; border: 0; min-width: 0; }
  .gh-choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 60px; box-sizing: border-box; padding: 10px 14px 10px 12px; border-radius: 16px; border: 1.5px solid var(--line-strong); background: var(--surface-solid); color: var(--text); font-weight: 500; line-height: 1.35; cursor: pointer; transition: border-color var(--dur-1), box-shadow var(--dur-1), background-color var(--dur-1); -webkit-tap-highlight-color: transparent; }
  .gh-choice > input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  .gh-choice-k { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-strong); font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); }
  .gh-choice-t { flex: 1; min-width: 0; }
  .gh-choice::after { content: ""; flex: none; box-sizing: border-box; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); }
  .gh-choice:has(> input[type="checkbox"])::after { border-radius: 7px; }
  .gh-choice:hover { border-color: var(--accent); }
  .gh-choice:has(> input:checked) { border: 2px solid var(--accent); padding: 9.5px 13.5px 9.5px 11.5px; background: linear-gradient(var(--accent-soft), var(--accent-soft)) var(--surface-solid); box-shadow: 0 0 0 4px var(--accent-soft); }
  .gh-choice:has(> input:checked) .gh-choice-k { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .gh-choice:has(> input:checked)::after { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 4px var(--surface-solid); }
  .gh-choice:has(> input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
  .gh-choice:has(> input:disabled) { opacity: .55; cursor: not-allowed; }
  @media (prefers-reduced-motion: reduce) { .gh-choice { transition: none; } }

  /* ── Хэсэгчилсэн явц — .gh-progress / GHUI.progress (v0.5.0, ТС-1 Ш-2; ПД) — бүлэг (чиглэл) бүр нэг хэсэг ── */
  .gh-progress { display: grid; gap: 8px; min-width: 0; }
  .gh-progress-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
  .gh-progress-seg { position: relative; height: 8px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
  .gh-progress-seg::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 0) * 100%); border-radius: 4px; background: var(--accent); transition: width var(--dur-2) var(--ease-out); }
  .gh-progress-meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
  .gh-progress-meta b { color: var(--accent); font: 800 var(--fs-sm) var(--font-display); letter-spacing: .02em; }
  .gh-progress-meta .gh-progress-label { color: var(--text); font-weight: 600; }
  .gh-progress-meta > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gh-progress-meta > span:last-child { flex: none; font-variant-numeric: tabular-nums; }
  @media (prefers-reduced-motion: reduce) { .gh-progress-seg::before { transition: none; } }

  /* ── Контекстын тууз — .gh-ctx / GHUI.ctx (v0.7.0; Fincolum ПСП §3-1): аль байгууллага, аль үе, төлөв, эрх — үргэлж харагдана ── */
  .gh-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; max-width: 100%; padding: 8px 14px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface-solid); font-size: var(--fs-sm); color: var(--text-2); }
  .gh-ctx-org { font-weight: 800; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .gh-ctx-per { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
  .gh-ctx-st { display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-xs); border: 1.5px solid currentColor; }
  .gh-ctx-st.open { color: var(--ok); background: var(--ok-soft); }
  .gh-ctx-st.closed { color: var(--text-2); background: var(--surface-2); }
  .gh-ctx-st svg { width: 12px; height: 12px; }
  .gh-ctx-env { padding: 1px 10px; border-radius: var(--r-pill); font-weight: 800; font-size: var(--fs-xs); color: var(--warn); background: var(--warn-soft); border: 1.5px solid var(--warn); }
  .gh-ctx-role { margin-left: auto; }
  @media (max-width: 560px) { .gh-ctx { width: 100%; } .gh-ctx-role { margin-left: 0; } }

  /* ── Хураангуйтай баталгаа — GHUI.confirm (v0.7.0; ПСП §3-2): буцаахгүй үйлдлийн өмнө «юу болох вэ» ── */
  .gh-confirm { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: var(--sp-5); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-3, 0 24px 64px oklch(0 0 0 / .3)); }
  .gh-confirm::backdrop { background: oklch(0.15 0.02 var(--gh-hue) / .45); }
  .gh-confirm h2 { margin: 0 0 var(--sp-3); font: 800 var(--fs-xl)/1.25 var(--font-display); letter-spacing: -0.01em; }
  .gh-confirm dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0 0 var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); }
  .gh-confirm dt { color: var(--text-2); }
  .gh-confirm dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .gh-confirm dd.ok { color: var(--ok); } .gh-confirm dd.bad { color: var(--bad); }
  .gh-confirm .note { margin: 0 0 var(--sp-4); color: var(--text-2); font-size: var(--fs-sm); }
  .gh-confirm label { display: grid; gap: 6px; margin-bottom: var(--sp-4); font-weight: 600; font-size: var(--fs-sm); }
  .gh-confirm .err { color: var(--bad); font-size: var(--fs-sm); font-weight: 600; min-height: 1.2em; margin: -8px 0 var(--sp-3); }
  .gh-confirm .acts { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }
  .gh-confirm .gh-btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
  [data-theme="dark"] .gh-confirm .gh-btn.danger { color: oklch(0.16 0.02 var(--gh-hue)); }
  @media (prefers-color-scheme: dark) { [data-theme="auto"] .gh-confirm .gh-btn.danger { color: oklch(0.16 0.02 var(--gh-hue)); } }
  @media (max-width: 560px) { .gh-confirm { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: var(--r-lg) var(--r-lg) 0 0; } .gh-confirm .acts .gh-btn { flex: 1; } }

  /* ── Төлөвийн тэмдэг — .gh-status[data-s] / GHUI.status (v0.3.1, ПР-1.8.1; ПД) ──
     өнгө + дүрс + үг (өнгөөр л биш — WCAG 1.4.1). Дүрс — CSS хэлбэр (фонт, эможи, зураг 0). */
  .gh-status { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 2px 10px 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; white-space: nowrap; border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); }
  .gh-status::before { content: ""; flex: none; box-sizing: border-box; width: 12px; height: 12px; border-radius: 50%; border: 1.5px dashed currentColor; }
  .gh-status[data-s="review"] { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
  .gh-status[data-s="review"]::before { border-style: solid; background: conic-gradient(currentColor 0 50%, transparent 0); }   /* ◔ — хагас */
  .gh-status[data-s="approved"] { color: var(--ok); background: var(--ok-soft); border-color: var(--ok); }
  .gh-status[data-s="approved"]::before { width: 6px; height: 11px; border: solid currentColor; border-width: 0 2.5px 2.5px 0; border-radius: 0; rotate: 45deg; margin: -3px 3px 0 3px; }   /* ✓ */
  .gh-status[data-s="retired"] { background: transparent; border-style: dashed; }
  .gh-status[data-s="retired"] > span { text-decoration: line-through; text-decoration-thickness: 1.5px; }
  .gh-status[data-s="retired"]::before { border-style: solid; background: linear-gradient(135deg, transparent 43%, currentColor 43% 57%, transparent 57%); }   /* ⊘ */

  /* ── Цэс — .gh-menu (<details>) (v0.3.1, ПР-1.8.1 §2: «Тусламж → Процессын зураглал»; ПД) ── */
  .gh-menu { position: relative; }
  .gh-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; color: var(--text-2); }
  .gh-menu > summary::-webkit-details-marker { display: none; }
  .gh-menu > summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: 45deg; margin: -4px 0 0 2px; transition: rotate var(--dur-1); }
  .gh-menu[open] > summary::after { rotate: 225deg; margin-top: 3px; }
  .gh-menu > summary:hover, .gh-menu[open] > summary { color: var(--text); background: var(--surface-2); }
  .gh-menu > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  .gh-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 248px; width: max-content; max-width: min(340px, calc(100vw - 24px)); margin: 0; padding: 6px; list-style: none; display: grid; gap: 2px; border-radius: var(--r-md); background: var(--surface-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2, 0 12px 32px oklch(0 0 0 / 0.18)); }
  .gh-menu-list a, .gh-menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
  .gh-menu-list a:hover, .gh-menu-list button:hover, .gh-menu-list a:focus-visible, .gh-menu-list button:focus-visible { background: var(--accent-soft); outline: none; }
  .gh-menu-list svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
  .gh-menu-list small { margin-left: auto; color: var(--text-2); font-size: var(--fs-xs); }
  @media print { .gh-menu { display: none; } }

  /* Хэвтээ — өргөн контейнерт (≥ 900 px): алхам баганаар, урсгал дотроо гүйлгэнэ (хуудас биш) */
  @container (min-width: 900px) {
    .gh-flow-steps { display: flex; gap: 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: var(--sp-2); }
    .gh-flow-step { flex: 0 0 236px; align-self: flex-start; grid-template-columns: 1fr; grid-template-rows: 44px auto; row-gap: var(--sp-2); padding: 0 var(--sp-3) 0 0; scroll-snap-align: start; }
    .gh-flow-step::before { left: 44px; right: 0; top: 21px; bottom: auto; width: auto; height: 2px; }
  }
  @media print {
    .gh-flow-steps { display: grid !important; overflow: visible !important; }
    .gh-flow-step { break-inside: avoid; grid-template-columns: 44px minmax(0, 1fr) !important; grid-template-rows: none !important; padding: 0 0 var(--sp-3) !important; }
    .gh-flow-step::before { left: 21px !important; top: 44px !important; bottom: 0 !important; right: auto !important; width: 2px !important; height: auto !important; }
    .gh-flow-more { display: grid !important; gap: 4px; }
    .gh-flow-go, .gh-flow-tools button { border: 0; padding: 0; min-height: 0; background: none; }
  }
}

@layer gh.motion {
  @property --gh-aurora-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
  @keyframes gh-shimmer { to { background-position: -200% 0; } }
  @keyframes gh-aurora { to { --gh-aurora-a: 360deg; } }
  @keyframes gh-rise { from { opacity: 0; translate: 0 18px; scale: .985; } }
  @keyframes gh-pop { from { opacity: 0; scale: .96; } }

  @media (prefers-reduced-motion: no-preference) {
    .gh-aurora { animation: gh-aurora 28s linear infinite; }
    .gh-cmd[open] { animation: gh-pop var(--dur-2) var(--ease-spring); }
    .gh-toast { animation: gh-rise var(--dur-3) var(--ease-spring); }
    /* Гүйлгэхэд гарч ирэх — зөвхөн CSS (scroll-driven) */
    @supports (animation-timeline: view()) {
      .gh-reveal { animation: gh-rise linear both; animation-timeline: view(); animation-range: entry 0% cover 22%; }
    }
    /* Хуудас/төлөв шилжих — View Transitions */
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 520ms; animation-timing-function: var(--ease-out); }
    ::view-transition-new(root) { animation-name: gh-reveal-circle; }
    ::view-transition-old(root) { animation: none; }
    @keyframes gh-reveal-circle { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0%)); } to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 0%)); } }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
    .gh-aurora, .gh-skel { animation: none !important; }
  }
}

@layer gh.utils {
  /* ── Бичгийн хэмжээ A− / A+ (v0.2.1): <html data-text="1|2|3"> — rem бүхэлдээ томорно ── */
  [data-text="1"] { --gh-text: 1.125; } [data-text="2"] { --gh-text: 1.25; } [data-text="3"] { --gh-text: 1.4; }

  /* ── «Тайван горим» (v0.2.1, DS-1.6 №2): <html data-mode="calm"> — СӨХ-ны ахмад гишүүн ──
     Хатуу гадаргуу (шилгүй), бичиг ≥ 16 px, товч ≥ 48 px, хөдөлгөөн бага (аврора, туяа, тоо гүйлгэлт, гарч ирэх 0). */
  [data-mode="calm"] {
    --gh-calm: 1.0625; --fs-xs: .95rem; --fs-sm: 1rem;
    --glass-blur: 0px; --surface: var(--surface-solid); --surface-2: var(--surface-solid); --text-3: var(--text-2);
  }
  [data-mode="calm"] body { background: var(--bg); line-height: 1.6; }
  [data-mode="calm"] :is(.gh-card, .gh-glass) { -webkit-backdrop-filter: none; backdrop-filter: none; }
  [data-mode="calm"] .gh-card::before, [data-mode="calm"] .gh-card::after { display: none; }
  [data-mode="calm"] .gh-card[data-lift]:hover { translate: none; }
  [data-mode="calm"] :is(.gh-btn, .gh-input, .gh-search) { min-height: 48px; }
  [data-mode="calm"] .gh-seg button { min-height: 44px; }
  [data-mode="calm"] :is(.gh-aurora, .gh-reveal, .gh-skel) { animation: none !important; }
  [data-mode="calm"] .gh-metric:not(.is-empty) .gh-metric-value { font-size: clamp(1.75rem, 1.4rem + 2cqi, 2.5rem); }

  /* ── «Талбарын горим» (v0.5.0, gh-ui v0.2-ын эрэмбэ №3, ТС-1 Ш-7): <html data-mode="field"> — талбай, нарны гэрэл, бээлий ──
     Цагаан / хар гадаргуу, тодрол ≥ 7 (бичиг), хүрээ зузаан, товч ≥ 56 px, сонголт ≥ 76 px, шил, хөдөлгөөн 0. Бараан сэдэвтэй хамт — хар дэвсгэр, цагаан бичиг. */
  [data-mode="field"] {
    --gh-calm: 1.0625; --fs-xs: .95rem; --fs-sm: 1rem;
    --bg: oklch(1 0 0); --bg-2: oklch(0.97 0.004 var(--gh-hue));
    --surface: oklch(1 0 0); --surface-solid: oklch(1 0 0); --surface-2: oklch(0.955 0.006 var(--gh-hue));
    --text: oklch(0.16 0.02 var(--gh-hue)); --text-2: oklch(0.3 0.02 var(--gh-hue)); --text-3: oklch(0.3 0.02 var(--gh-hue));
    --line: oklch(0.45 0.03 var(--gh-hue) / 0.55); --line-strong: oklch(0.38 0.03 var(--gh-hue));
    --accent: oklch(0.4 0.14 var(--gh-hue)); --accent-ink: oklch(1 0 0); --accent-soft: oklch(0.4 0.14 var(--gh-hue) / 0.22);
    --ok: oklch(0.4 0.11 150); --warn: oklch(0.42 0.1 60); --bad: oklch(0.45 0.18 27);
    --glass-blur: 0px; --shadow-1: none; --shadow-2: 0 0 0 1.5px var(--line-strong); --shadow-3: 0 0 0 2px var(--line-strong);
  }
  [data-mode="field"][data-theme="dark"] {
    --bg: oklch(0.1 0 0); --bg-2: oklch(0.14 0.005 var(--gh-hue));
    --surface: oklch(0.14 0.008 var(--gh-hue)); --surface-solid: oklch(0.14 0.008 var(--gh-hue)); --surface-2: oklch(0.2 0.01 var(--gh-hue));
    --text: oklch(0.99 0 0); --text-2: oklch(0.9 0.01 var(--gh-hue)); --text-3: oklch(0.9 0.01 var(--gh-hue));
    --line: oklch(0.8 0.02 var(--gh-hue) / 0.55); --line-strong: oklch(0.82 0.02 var(--gh-hue));
    --accent: oklch(0.84 0.16 var(--gh-hue)); --accent-ink: oklch(0.12 0.02 var(--gh-hue)); --accent-soft: oklch(0.84 0.16 var(--gh-hue) / 0.25);
    --ok: oklch(0.85 0.15 150); --warn: oklch(0.86 0.14 75); --bad: oklch(0.8 0.15 27);
  }
  @media (prefers-color-scheme: dark) {
    [data-mode="field"][data-theme="auto"] {
      --bg: oklch(0.1 0 0); --bg-2: oklch(0.14 0.005 var(--gh-hue));
      --surface: oklch(0.14 0.008 var(--gh-hue)); --surface-solid: oklch(0.14 0.008 var(--gh-hue)); --surface-2: oklch(0.2 0.01 var(--gh-hue));
      --text: oklch(0.99 0 0); --text-2: oklch(0.9 0.01 var(--gh-hue)); --text-3: oklch(0.9 0.01 var(--gh-hue));
      --line: oklch(0.8 0.02 var(--gh-hue) / 0.55); --line-strong: oklch(0.82 0.02 var(--gh-hue));
      --accent: oklch(0.84 0.16 var(--gh-hue)); --accent-ink: oklch(0.12 0.02 var(--gh-hue)); --accent-soft: oklch(0.84 0.16 var(--gh-hue) / 0.25);
      --ok: oklch(0.85 0.15 150); --warn: oklch(0.86 0.14 75); --bad: oklch(0.8 0.15 27);
    }
  }
  [data-mode="field"] body { background: var(--bg); line-height: 1.55; }
  [data-mode="field"] :is(.gh-card, .gh-glass) { -webkit-backdrop-filter: none; backdrop-filter: none; border: 2px solid var(--line-strong); }
  [data-mode="field"] .gh-card::before, [data-mode="field"] .gh-card::after { display: none; }
  [data-mode="field"] .gh-card[data-lift]:hover { translate: none; }
  [data-mode="field"] :is(.gh-btn, .gh-input) { min-height: 56px; border-width: 2px; font-weight: 700; }
  [data-mode="field"] .gh-seg button { min-height: 48px; }
  [data-mode="field"] .gh-search { min-height: 56px; border-width: 2px; }
  [data-mode="field"] .gh-cmd li[role="option"] { min-height: 56px; }
  [data-mode="field"] :is(.gh-aurora, .gh-reveal, .gh-skel) { animation: none !important; }
  [data-mode="field"] .gh-aurora { display: none; }
  [data-mode="field"] .gh-choice { min-height: 76px; border-width: 2.5px; border-radius: 14px; font-weight: 600; font-size: 1.06em; padding: 10px 14px 10px 12px; }
  [data-mode="field"] .gh-choice-k { width: 36px; height: 36px; font-size: 1.05em; border-width: 2px; }
  [data-mode="field"] .gh-choice::after { width: 28px; height: 28px; border-width: 2.5px; }
  [data-mode="field"] .gh-choice:has(> input:checked) { border-width: 2.5px; padding: 10px 14px 10px 12px; background: var(--accent) none; color: var(--accent-ink); box-shadow: none; }
  [data-mode="field"] .gh-choice:has(> input:checked) .gh-choice-k { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
  [data-mode="field"] .gh-choice:has(> input:checked)::after { border-color: var(--accent-ink); background: var(--accent-ink); box-shadow: inset 0 0 0 5px var(--accent); }
  [data-mode="field"] .gh-progress-seg { height: 10px; }

  .gh-wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }
  .gh-stack { display: grid; gap: var(--sp-4); }
  .gh-row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
  .gh-muted { color: var(--text-2); } .gh-small { font-size: var(--fs-sm); }
  .gh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ═══ Санхүүгийн бүрэлдэхүүн (v0.8.0, ФП-1 §5 №1–5; ПД) ═══════════════════════════════════ */
@layer gh.components {
  /* Мөнгөн дүн — GHUI.money */
  .gh-money { text-align: right; font-variant-numeric: tabular-nums; }
  .gh-money::placeholder { color: var(--text-3); opacity: .75; font-style: italic; }

  /* Combobox — GHUI.combobox: жагсаалт дээд давхаргад (popover) — хүснэгтийн гүйлгээнд тасрахгүй */
  .gh-combo { position: relative; display: grid; gap: 6px; }
  .gh-combo > label { font-weight: 600; font-size: var(--fs-sm); }
  .gh-combo-in[aria-invalid="true"], .gh-entry .gh-input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
  .gh-combo.off .gh-combo-in { background: transparent; border-style: dashed; color: var(--text-3); }
  .gh-combo-list { position: fixed; inset: auto; margin: 0; z-index: 1000; display: none; overflow: auto; padding: 4px; list-style: none; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-2); }
  .gh-combo-list.open { display: block; }
  .gh-combo-list li[role="option"] { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: baseline; padding: 8px 10px; min-height: 40px; border-radius: var(--r-sm); cursor: pointer; }
  .gh-combo-list li b { font-variant-numeric: tabular-nums; color: var(--accent); min-width: 4.5ch; }
  .gh-combo-list li small { grid-column: 2; color: var(--text-2); font-size: var(--fs-xs); }
  .gh-combo-list li[aria-selected="true"] { background: var(--accent-soft); outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
  .gh-combo-list li[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
  .gh-combo-empty { padding: 10px; color: var(--text-2); font-size: var(--fs-sm); }

  /* Журналын засварлах тор — GHUI.entry (Д-1) */
  .gh-entry { container-type: inline-size; display: grid; gap: var(--sp-3); }
  .gh-entry-wrap { border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-solid); overflow: hidden; }
  .gh-entry-t { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: var(--fs-sm); }
  .gh-entry-t th { text-align: left; font-weight: 600; color: var(--text-3); padding: 8px 6px; background: var(--surface-2); border-bottom: 1px solid var(--line-strong); }
  .gh-entry-t th:nth-child(1) { width: 2.6em; } .gh-entry-t th:nth-child(2) { width: 32%; } .gh-entry-t th:nth-child(3) { width: 17%; }
  .gh-entry-t th.r { width: 14%; text-align: right; } .gh-entry-t th:last-child { width: 2.6em; }
  .gh-entry-t td { padding: 3px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .gh-entry-t td.n { text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; }
  .gh-entry-t .gh-input { min-height: 36px; border-radius: 8px; padding: 0 8px; border-color: transparent; background: transparent; }
  .gh-entry-t .gh-money { text-align: right; }
  .gh-entry-t .gh-input:hover { border-color: var(--line-strong); }
  .gh-entry-t .gh-input:focus { border-color: var(--accent); background: var(--surface-solid); box-shadow: 0 0 0 3px var(--accent-soft); }
  .gh-entry-t tbody tr:focus-within { background: var(--accent-soft); }
  .gh-entry-del { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text-3); font-size: 18px; cursor: pointer; }
  .gh-entry-del:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); } .gh-entry-del:disabled { opacity: .25; cursor: default; }
  .gh-entry-sum { padding: 0 !important; border-top: 2px solid var(--line-strong); background: var(--surface-2); }
  .gh-entry-sum > div { padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-end; align-items: baseline; font-variant-numeric: tabular-nums; }
  .gh-entry-sum > div > span:first-child { margin-right: auto; font-weight: 700; }
  .gh-entry-sum .v { font-weight: 700; }
  .gh-entry-sum b.ok { color: var(--ok); } .gh-entry-sum b.bad { color: var(--bad); }
  .gh-entry-acts { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
  .gh-entry-hint { margin: 0; color: var(--text-2); font-size: var(--fs-xs); }
  .gh-entry-hint kbd, .gh-kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface-2); }
  @container (max-width: 640px) {   /* утсанд мөр бүр карт — бүх нүд харагдана, хэвтээ гүйлгээ 0 */
    .gh-entry-wrap { border: 0; background: none; overflow: visible; }
    .gh-entry-t, .gh-entry-t tbody, .gh-entry-t tfoot, .gh-entry-t tr { display: block; }
    .gh-entry-t thead { display: none; }
    .gh-entry-t tbody tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 10px 40px 10px 12px; margin-bottom: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-solid); }
    .gh-entry-t td { display: grid; gap: 2px; padding: 0; border: 0; }
    .gh-entry-t td::before { content: attr(data-label); font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); }
    .gh-entry-t td.n { position: absolute; top: 10px; right: 10px; } .gh-entry-t td.n::before { content: none; }
    .gh-entry-t td.acc, .gh-entry-t td.memo { grid-column: 1 / -1; } .gh-entry-t td.x { position: absolute; right: 4px; bottom: 8px; } .gh-entry-t td.x::before { content: none; }
    .gh-entry-t .gh-input { border-color: var(--line-strong); min-height: 44px; }
    .gh-entry-sum { display: block; border: 1px solid var(--line-strong); border-radius: var(--r-md); }
  }

  /* Нягт хүснэгт — GHUI.table / .gh-table.dense (Д-2; ФП-1 §5 №2) */
  .gh-dense { container-type: inline-size; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-solid); }
  .gh-dense:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  .gh-dense.sub { border-radius: var(--r-sm); margin: 4px 0 8px; box-shadow: inset 3px 0 0 var(--accent); }
  .gh-table.dense { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
  .gh-table.dense th, .gh-table.dense td { padding: 6px 10px; line-height: 1.35; }
  .gh-table.dense thead th { z-index: 2; background: var(--surface-solid); box-shadow: inset 0 -1px 0 var(--line-strong); white-space: nowrap; }
  .gh-table.dense tbody th { font-weight: 500; text-align: left; }
  .gh-table.dense .r { text-align: right; white-space: nowrap; }
  .gh-table.dense .neg { color: var(--bad); }
  .gh-table.dense.sticky1 > tbody > tr > th, .gh-table.dense.sticky1 > thead > tr > th:first-child, .gh-table.dense.sticky1 > tfoot > tr > th { position: sticky; left: 0; z-index: 1; background: var(--surface-solid); }
  .gh-table.dense.sticky1 > thead > tr > th:first-child { z-index: 3; }
  .gh-table.dense.sticky1.hasx > :is(tbody, thead, tfoot) > tr > :is(th:not(.xc)) { left: 36px; } .gh-table.dense.sticky1.hasx > :is(tbody, thead, tfoot) > tr > .xc { position: sticky; left: 0; z-index: 1; background: var(--surface-solid); } .gh-table.dense.sticky1.hasx > thead > tr > th:nth-child(2) { position: sticky; z-index: 3; } .gh-table.dense.sticky1.hasx > tbody > tr.gh-grp > th { left: 0; }
  .gh-table.dense > tbody > tr:hover > * { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface-solid); }
  .gh-table.dense tr.click { cursor: pointer; } .gh-table.dense tr.click:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  .gh-table.dense .gh-grp th { padding-top: 12px; font: 700 var(--fs-sm) var(--font); color: var(--accent); background: var(--surface-2); text-align: left; }
  .gh-table.dense .gh-subtot > * { font-weight: 700; background: var(--surface-2); border-bottom: 2px solid var(--line-strong); }
  .gh-table.dense tfoot .gh-total > * { font-weight: 800; color: var(--text); background: var(--surface-solid); border-top: 2px solid var(--text-2); border-bottom: 0; padding-top: 9px; padding-bottom: 9px; }
  .gh-table.dense td.xc, .gh-table.dense th.xc { width: 36px; padding: 0 0 0 6px; }
  .gh-x { width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
  .gh-x::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: -45deg; transition: rotate var(--dur-1); }
  .gh-x[aria-expanded="true"]::before { rotate: 45deg; } .gh-x:hover { background: var(--accent-soft); color: var(--accent); }
  .gh-x:focus-visible { outline: 2px solid var(--focus); }
  .gh-table.dense .gh-subrow > td { padding: 0 8px 0 36px; background: var(--bg-2); }
  .gh-sub-load { padding: 10px; font-size: var(--fs-sm); } .gh-sub-load.bad { color: var(--bad); }
  .gh-table.dense .gh-empty-row td { text-align: center; padding: 28px; color: var(--text-2); }
  .gh-table.dense .gh-skel span { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: gh-skel 1.2s linear infinite; }
  @keyframes gh-skel { to { background-position: -200% 0; } }
  @container (max-width: 640px) {   /* утсанд — мөр бүр карт (нэр: утга) */
    .gh-dense:not(.sub) { border: 0; background: none; overflow: visible; }
    .gh-dense:not(.sub) > .gh-table.dense, .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) { display: block; }
    .gh-dense:not(.sub) > .gh-table.dense > thead { display: none; }
    .gh-dense:not(.sub) { max-height: none !important; }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr { display: grid; gap: 2px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-solid); }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr > :is(td, th) { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 0; border: 0; background: none; position: static; text-align: right; }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr > :is(td, th)[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; text-align: left; }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr > th:first-of-type { display: block; text-align: left; font-weight: 700; padding-bottom: 4px; } .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr > th:first-of-type::before { content: none; }
    .gh-dense:not(.sub) > .gh-table.dense > tbody > tr.gh-grp, .gh-dense:not(.sub) > .gh-table.dense > tbody > tr.gh-subrow { display: block; border: 0; background: none; padding: 8px 0 0; }
    .gh-dense:not(.sub) > .gh-table.dense > tbody > tr.gh-subrow > td { display: block; padding: 0; }
    .gh-dense:not(.sub) > .gh-table.dense > tbody > tr > td.xc { order: 99; justify-content: flex-start; }
    .gh-dense:not(.sub) > .gh-table.dense > tbody > tr > td.xc:empty { display: none; }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr:has(> td.xc) { display: flex; flex-direction: column; }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr > td.xc:has(.gh-x)::after { content: "Задлах"; font-size: var(--fs-xs); font-weight: 600; color: var(--accent); }
    .gh-dense:not(.sub) > .gh-table.dense > :is(tbody, tfoot) > tr > td.xc { align-items: center; justify-content: flex-start; }
    .gh-dense:not(.sub) > .gh-table.dense tbody tr:hover > * { background: none; }
    .gh-dense:not(.sub) > .gh-table.dense .gh-total > * { position: static; border: 0; }
  }

  /* Утасны батлах карт — GHUI.approve (Д-5) */
  .gh-approve { display: grid; gap: var(--sp-3); max-width: 560px; }
  .gh-approve header { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
  .gh-approve header .k { font-weight: 700; color: var(--text-2); font-size: var(--fs-sm); }
  .gh-approve .amt { font: 800 clamp(2rem, 1.5rem + 2vw, 2.6rem)/1.1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
  .gh-approve .amt .u { font-size: .55em; margin-left: .25em; color: var(--text-2); }
  .gh-approve .t { margin: 0; font-weight: 600; }
  .gh-approve dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); }
  .gh-approve dt { color: var(--text-2); } .gh-approve dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
  .gh-approve details summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
  .gh-approve-lines { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
  .gh-approve-lines th { text-align: left; color: var(--text-3); font-weight: 600; padding: 4px 0; border-bottom: 1px solid var(--line); }
  .gh-approve-lines td { padding: 6px 0; border-bottom: 1px solid var(--line); } .gh-approve-lines .r { text-align: right; padding-left: 10px; white-space: nowrap; }
  .gh-approve-files { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
  .gh-approve-files small { color: var(--text-2); margin-left: 6px; }
  .gh-approve .warn { margin: 0; color: var(--warn); font-weight: 700; }
  .gh-approve .acts { display: flex; gap: var(--sp-2); justify-content: flex-end; }
  .gh-approve .acts .gh-btn { min-width: 120px; }
  .gh-approve .self { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
  .gh-approve .done { margin: 0; font-weight: 700; } .gh-approve .done.ok { color: var(--ok); }
  @media (max-width: 560px) {
    .gh-approve { max-width: none; }
    .gh-approve .acts:has(.gh-btn) { position: sticky; bottom: 0; margin: 0 calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)); padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom)); background: var(--surface-solid); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); }
    .gh-approve .acts .gh-btn { flex: 1; min-height: 52px; }
  }

  /* Хэвлэх маягт — GHUI.form (№347 / №100; ФП-1 §4): дэлгэцэнд цаас, хэвлэхэд A4 хар цагаан */
  .gh-form { --ink: #111; --rule: .5pt solid #111; box-sizing: border-box; width: min(210mm, 100%); min-height: 297mm; margin: 0 auto var(--sp-5); padding: 15mm 15mm 18mm 20mm; background: #fff; color: var(--ink); box-shadow: var(--shadow-2); font: 10.5pt/1.35 var(--font); color-scheme: light; page: gh-a4; break-after: page; }
  .gh-form.land { width: min(297mm, 100%); min-height: 210mm; page: gh-a4l; }
  .gh-form-top { display: flex; justify-content: space-between; gap: 10mm; font-size: 8.5pt; }
  .gh-form-top .order { max-width: 72mm; text-align: right; font-style: italic; }
  .gh-form h1 { margin: 7mm 0 1mm; text-align: center; font: 700 13pt/1.25 var(--font); text-transform: uppercase; letter-spacing: .02em; }
  .gh-form h1 .no { text-transform: none; }
  .gh-form-date { text-align: center; margin: 0 0 5mm; }
  .gh-form-parties { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); gap: 8mm; margin-bottom: 4mm; }
  .gh-form-parties h2 { margin: 0 0 1.5mm; font: 700 10.5pt var(--font); border-bottom: var(--rule); }
  .gh-form dl { display: grid; grid-template-columns: auto 1fr; gap: 1mm 3mm; margin: 0; }
  .gh-form dt { color: var(--ink); } .gh-form dt::after { content: ":"; }
  .gh-form dd { margin: 0; border-bottom: .5pt dotted #555; min-height: 1.3em; overflow-wrap: anywhere; }
  .gh-form-fields { margin-bottom: 4mm !important; }
  .gh-form-t { width: 100%; border-collapse: collapse; margin: 2mm 0 3mm; font-size: 9.5pt; font-variant-numeric: tabular-nums; }
  .gh-form-t th, .gh-form-t td { border: var(--rule); padding: 1.2mm 1.6mm; vertical-align: top; }
  .gh-form-t thead th { font-weight: 700; text-align: center; vertical-align: middle; }
  .gh-form-t thead tr.nums th { font-weight: 400; font-size: 8pt; padding: .4mm; }
  .gh-form-t .r { text-align: right; white-space: nowrap; }
  .gh-form-t tr.blank td { height: 5.5mm; }
  .gh-form-t tfoot th { text-align: right; } .gh-form-t tfoot td, .gh-form-t tfoot th { font-weight: 700; }
  .gh-form-words { margin: 0 0 4mm; } .gh-form-note { margin: 0 0 4mm; font-size: 9pt; }
  .gh-form-signs { display: grid; gap: 5mm; margin-top: 8mm; max-width: 150mm; }
  .gh-form-signs.st { grid-template-columns: 40mm 1fr; column-gap: 10mm; }
  .gh-form-signs.st > p { grid-column: 2; }
  .gh-form-signs .stamp { grid-row: 1 / span 4; width: 34mm; height: 34mm; border: .5pt dashed #777; border-radius: 50%; display: grid; place-items: center; color: #777; font-size: 8.5pt; align-self: start; }
  .gh-form-signs p { display: grid; grid-template-columns: minmax(32mm, auto) 1fr auto; align-items: end; gap: 3mm; margin: 0; }
  .gh-form-signs .line { border-bottom: .5pt solid #111; height: 1.2em; }
  .gh-form-signs .nm { white-space: pre; }
  .gh-form-copy { margin: 6mm 0 0; font-size: 8.5pt; text-align: right; }
  @media (max-width: 820px) { .gh-form { min-height: 0; padding: 18px 14px; font-size: 13px; } .gh-form-parties { grid-template-columns: 1fr; gap: 12px; } .gh-form-top { flex-direction: column; gap: 4px; } .gh-form-top .order { text-align: left; } .gh-form-t { display: block; overflow-x: auto; } }
}
@page gh-a4 { size: A4 portrait; margin: 0; }
@page gh-a4l { size: A4 landscape; margin: 0; }
@media print {
  .gh-form { width: auto; min-height: 0; margin: 0; box-shadow: none; }
  .gh-form:last-child { break-after: auto; }
  .gh-form-t thead { display: table-header-group; } .gh-form-t tr { break-inside: avoid; }
  [data-gh-print="forms"] body > :not(.gh-form-stack) { display: none !important; }
  [data-gh-print="forms"] body { background: #fff !important; }
  .gh-combo-list, .gh-entry-acts, .gh-approve .acts { display: none !important; }
}
.gh-form-stack { display: none; }
@media print { .gh-form-stack { display: block; } }
@layer gh.components { .gh-table.dense > tbody > tr.gh-subtot > * { background: linear-gradient(var(--surface-2), var(--surface-2)), var(--surface-solid); } }
