/* Module M03 · Danh mục dịch vụ — the screens on the module menu (frames DanhMucDichVu, TraCuu, BienTapDanhMuc).
   The look-ups (M03-03 – M03-06) stay M03's screens, placed in M11 "Tự phục vụ" on the menu.
   Loaded after modnav.css on index.html and admin.html; applies only while CDLAF_FEATURES.ui('m03') is on:
     index.html  body.mn-on (module_nav, modnav.js) without .feat-off-ui_catalog (app.js applyFeatures);
     admin.html  body.m3-ui, set by admin-catalog.js (the admin page has no feat-off classes).
   The page's own tokens (--surface, --line, --accent…), so light and dark follow the app; Verdana from --font-ui. */

/* ---------------------------------------------------------------- M03-01 Danh mục dịch vụ (catalog-ui.js) */
body.mn-on:not(.feat-off-ui_catalog) .m3c { display: flex; flex-direction: column; gap: 16px; font-family: var(--font-ui); color: var(--ink); }
body.mn-on:not(.feat-off-ui_catalog) .m3c .note { margin: 0; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-search svg { flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-search input { flex: 1; min-width: 0; font: inherit; font-size: 13px; border: 0; outline: none; background: transparent; color: inherit; padding: 0; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-search:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-cols { display: grid; grid-template-columns: minmax(190px, 230px) minmax(0, 1fr) minmax(250px, 320px); gap: 16px; align-items: start; }

/* left: the groups */
body.mn-on:not(.feat-off-ui_catalog) .m3c-nav { position: sticky; top: 12px; max-height: calc(100vh - 140px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-nav > * { flex: none; }   /* a scrolling column: the groups keep their height */
body.mn-on:not(.feat-off-ui_catalog) .m3c-view { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-fg { padding: 8px 10px 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-g { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 12px; line-height: 1.35; text-align: left; cursor: pointer; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-g b { color: var(--accent); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-g small { font-size: 11px; color: var(--muted); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-g:hover { background: var(--sunken); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-g[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-g.empty { opacity: .55; }

/* middle: the group, its level-2 groups as cards */
body.mn-on:not(.feat-off-ui_catalog) .m3c-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-head { display: flex; flex-direction: column; gap: 2px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-k { font-size: 12px; color: var(--muted); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-accent { font-weight: 700; color: var(--accent); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-title { margin: 0; font-family: var(--font-head); font-size: 18px; font-weight: 700; line-height: 1.35; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-chips { margin: 0; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-card-h { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--sunken); border-bottom: 1px solid var(--line); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-card-h b { font-size: 13px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-card-h span { flex: none; font-size: 12px; color: var(--muted); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-row { display: flex; gap: 10px; align-items: baseline; width: 100%; min-height: 40px; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-row:last-child { border-bottom: 0; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-row:hover { background: var(--sunken); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-row[aria-pressed="true"] { background: var(--accent-soft); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-row[aria-pressed="true"] .m3c-name { font-weight: 700; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-code { flex: none; width: 76px; font-size: 11px; font-weight: 700; color: var(--accent); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-name { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-type { flex: none; max-width: 32%; font-size: 11px; color: var(--muted); text-align: right; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-db { display: flex; flex-direction: column; gap: 6px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-db-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-db-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-db-card b { font-size: 13px; color: var(--accent); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-db-card span { font-size: 12px; color: var(--muted); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-db-card:hover { border-color: var(--accent); }

/* right: the service chosen */
body.mn-on:not(.feat-off-ui_catalog) .m3c-pane { position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-pane:focus { outline: none; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-x { display: none; position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 22px; cursor: pointer; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-svc { margin: 0; font-family: var(--font-head); font-size: 16px; font-weight: 700; line-height: 1.35; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-facts { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-fact { display: flex; flex-direction: column; overflow-wrap: anywhere; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-fact > span { font-size: 12px; color: var(--muted); }
body.mn-on:not(.feat-off-ui_catalog) .m3c-acts { display: flex; flex-wrap: wrap; gap: 8px; }
body.mn-on:not(.feat-off-ui_catalog) .m3c-acts .btn { min-height: 40px; }
body.mn-on:not(.feat-off-ui_catalog) .rp-inline { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
body.mn-on:not(.feat-off-ui_catalog) .rp-inline .rp-kinds { grid-template-columns: 1fr; background: var(--surface); }
body.mn-on:not(.feat-off-ui_catalog) .rp-inline .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
body.mn-on:not(.feat-off-ui_catalog) .rp-inline textarea, body.mn-on:not(.feat-off-ui_catalog) .rp-inline input[type="text"] { width: 100%; box-sizing: border-box; }
body.mn-on:not(.feat-off-ui_catalog) .rp-inline .msg:empty { display: none; }

/* a medium screen: the groups as a row above, the list and the service side by side */
@media (max-width: 1100px) {
  body.mn-on:not(.feat-off-ui_catalog) .m3c-cols { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-nav { grid-column: 1 / -1; position: static; max-height: none; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 6px; }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-view { flex: none; margin: 0 6px 0 0; flex-wrap: nowrap; align-items: center; }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-fg { display: none; }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-g { flex: none; width: auto; display: inline-flex; white-space: nowrap; }
}
/* a phone: one column; the service opens in a sheet from the bottom */
@media (max-width: 760px) {
  body.mn-on:not(.feat-off-ui_catalog) .m3c-cols { grid-template-columns: minmax(0, 1fr); }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-pane { display: none; }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-pane.has-sel { display: flex; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 80; max-height: 78vh; padding: 20px 16px 24px; border-radius: 12px 12px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .18); }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-x { display: block; }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-row { padding: 8px 12px; }
  body.mn-on:not(.feat-off-ui_catalog) .m3c-code { width: 64px; }
}
@media (max-width: 480px) {
  body.mn-on:not(.feat-off-ui_catalog) .m3c-type { display: none; }
}

/* ---------------------------------------------------------------- M03-03 – M03-06 Tra cứu ngành nghề */
/* the page's own title repeats the module header and its sub-tab (linecheck's: modnav.css) */
body.mn-on:not(.feat-off-ui_catalog) #view-vsic .vs-head .sec-title,
body.mn-on:not(.feat-off-ui_catalog) #view-wto .vs-head .sec-title,
body.mn-on:not(.feat-off-ui_catalog) #view-cond .cond > .card-head { display: none; }
body.mn-on:not(.feat-off-ui_catalog) #view-vsic .vs-head .note,
body.mn-on:not(.feat-off-ui_catalog) #view-wto .vs-head .note { margin-top: 0; }
/* the check: column "VSIC 2025" (linecheck.js) */
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 { min-width: 880px; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 th:nth-child(1) { width: 22%; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 th:nth-child(2) { width: 150px; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 th:nth-child(3) { width: 190px; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 td:nth-child(3) .badge { white-space: normal; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 th:nth-child(4) { width: auto; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 th:nth-child(5) { width: 26%; }
body.mn-on:not(.feat-off-ui_catalog) .cond-table.lc-table.lc-m3 td:nth-child(2) { width: auto; }
body.mn-on:not(.feat-off-ui_catalog) .lc-vsic b { color: var(--accent); }
body.mn-on:not(.feat-off-ui_catalog) .lc-vsic .note { display: block; margin: 2px 0 0; font-size: 12px; }
/* the conditional lines: the list each one comes from (conditions.js) */
body.mn-on:not(.feat-off-ui_catalog) .m3-src { display: inline-flex; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }

/* ---------------------------------------------------------------- M03-07 Biên tập danh mục dịch vụ (admin.html, admin-catalog.js) */
/* two columns: the reports waiting, the tools and the services on the left; the editor on the right, kept in sight */
body.m3-ui .m3a { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
body.m3-ui .m3a-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
body.m3-ui .m3a-left > .card, body.m3-ui .m3a-right > .card { margin: 0; }
body.m3-ui .m3a-left .row > input, body.m3-ui .m3a-left .row > select { min-width: 0; max-width: 100%; }   /* long group names in a narrower column */
body.m3-ui .m3a-right { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; min-width: 0; }
body.m3-ui .m3a-empty { margin: 0; padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
body.m3-ui .m3a-right #cat-edit:not([hidden]) + .m3a-empty { display: none; }
body.m3-ui #cat-reports { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
body.m3-ui .m3a-reps { display: flex; flex-direction: column; gap: 8px; }
body.m3-ui .m3a-rep { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
body.m3-ui .m3a-rep:hover { border-color: var(--accent); }
body.m3-ui .m3a-rep[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
body.m3-ui .m3a-rep-k { font-size: 12px; }
body.m3-ui .m3a-rep-k b { color: var(--accent); }
body.m3-ui .m3a-rep-n { font-size: 13px; }
body.m3-ui .m3a-rep-c { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
body.m3-ui .m3a-rep-s { font-size: 12px; font-weight: 700; }
body.m3-ui .m3a-st-open { color: var(--warn); }
body.m3-ui .m3a-st-fixed { color: var(--ok); }
body.m3-ui .m3a-st-rejected { color: var(--muted); }
body.m3-ui .m3a-repbox { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
body.m3-ui .m3a-repbox h3 { margin: 0 0 4px; font-size: 14px; }
body.m3-ui #cat-edit .row .btn { min-height: 40px; }
@media (max-width: 900px) {
  body.m3-ui .m3a { grid-template-columns: minmax(0, 1fr); }
  body.m3-ui .m3a-right { position: static; max-height: none; overflow: visible; }
}
