/* NSDA Competency Research Portal — front end. No JavaScript required. */
.nsda-portal, .nsda-doc { --nsda-navy: #0b2f55; --nsda-blue: #0b4f8a; --nsda-line: #d5dce3; --nsda-soft: #f3f6f9; --nsda-amber: #b45309; --nsda-green: #1f7a3f; --nsda-bg: #fff; --nsda-text: #1b2430; --nsda-muted: #5b6672; --nsda-th: #e8eef5; --nsda-radius: 6px; --nsda-size: 16px; --nsda-form-size: 17px; --nsda-h-scale: 1; --nsda-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; --nsda-head-font: var(--nsda-font); --nsda-code-font: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--nsda-font); font-size: var(--nsda-size); line-height: 1.6; color: var(--nsda-text); max-width: 1200px; margin: 0 auto; }
.nsda-portal h1, .nsda-portal h2, .nsda-portal h3, .nsda-portal h4, .nsda-doc h1, .nsda-doc h2, .nsda-doc h3, .nsda-doc h4 { font-family: var(--nsda-head-font); }
.nsda-doc *, .nsda-portal * { box-sizing: border-box; }
.nsda-doc a, .nsda-portal a { color: var(--nsda-blue); }

/* Header */
.nsda-breadcrumb { font-size: .85em; color: var(--nsda-muted); margin: 0 0 .75em; }
.nsda-breadcrumb .sep { margin: 0 .3em; color: #9aa5b1; }
.nsda-head { border-bottom: 3px solid var(--nsda-blue); padding-bottom: .75em; margin-bottom: 1em; }
.nsda-kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .78em; font-weight: 700; color: var(--nsda-blue); margin: 0 0 .25em; }
.nsda-title { font-size: calc(clamp(1.4em, 2.6vw, 2em) * var(--nsda-h-scale)); line-height: 1.2; margin: 0 0 .5em; color: var(--nsda-navy); }
.nsda-doc-embedded-title { font-size: 1.35em; color: var(--nsda-navy); margin: .5em 0 1em; }
.nsda-code { font-family: var(--nsda-code-font); font-size: .9em; white-space: nowrap; }
.nsda-status, .nsda-tag { display: inline-block; font-size: .75em; font-weight: 600; padding: .1em .55em; border-radius: 999px; border: 1px solid var(--nsda-line); background: var(--nsda-bg); vertical-align: middle; }
.nsda-status-current { background: #e7f5ec; border-color: #a6d8b6; color: var(--nsda-green); }
.nsda-status-superseded { background: #f4f4f4; color: #666; }
.nsda-status-review { background: #fff4e0; border-color: #f0c98a; color: var(--nsda-amber); }
.nsda-status-draft { background: #eef2ff; border-color: #c7d0f5; color: #3f4fa8; }

/* Notices */
.nsda-disclaimer { border-left: 5px solid var(--nsda-amber); background: #fff8eb; padding: .8em 1em; margin: 1em 0; font-size: .9em; border-radius: var(--nsda-radius); }
.nsda-disclaimer-line { font-size: .82em; color: #6b5a3a; background: #fffaf0; border: 1px dashed #e7c88f; padding: .45em .75em; border-radius: var(--nsda-radius); margin: 1em 0; }
.nsda-version-banner { background: #eaf2fb; border: 1px solid #b7cfe9; padding: .7em 1em; border-radius: var(--nsda-radius); margin: 0 0 1em; }
.nsda-locked { border: 1px solid var(--nsda-line); padding: 1.25em; border-radius: var(--nsda-radius); background: var(--nsda-soft); }
.nsda-muted { color: var(--nsda-muted); font-size: .9em; }
.nsda-empty { padding: 1em; background: var(--nsda-soft); border-radius: var(--nsda-radius); }

/* Buttons */
.nsda-btn { font-family: inherit; display: inline-block; border: 1px solid var(--nsda-blue); background: var(--nsda-blue); color: #fff !important; padding: .45em .9em; border-radius: var(--nsda-radius); text-decoration: none; font-size: .9em; font-weight: 600; cursor: pointer; line-height: 1.3; }
.nsda-btn:hover, .nsda-btn:focus { background: var(--nsda-navy); }
.nsda-btn-ghost { background: var(--nsda-bg); color: var(--nsda-blue) !important; }
.nsda-btn-ghost:hover, .nsda-btn-ghost:focus { background: var(--nsda-soft); }
.nsda-actions { display: flex; flex-wrap: wrap; gap: .5em; margin: 0 0 1em; }

/* Tabs (plain links) */
.nsda-tabs ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0; margin: 1em 0 0; padding: 0; border-bottom: 2px solid var(--nsda-blue); }
.nsda-tabs li { margin: 0; }
.nsda-tabs a { display: block; padding: .6em 1em; text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: var(--nsda-radius) 4px 0 0; color: var(--nsda-blue); font-weight: 600; font-size: .92em; }
.nsda-tabs li.is-active a { background: var(--nsda-blue); color: #fff; }
.nsda-tabs a:hover { background: var(--nsda-soft); }
.nsda-tabs li.is-active a:hover { background: var(--nsda-navy); }
.nsda-tab-panel { padding-top: 1em; }

/* Sections */
.nsda-section { margin: 0 0 1.25em; scroll-margin-top: 80px; }
.nsda-section > details > summary, .nsda-toc summary, .nsda-toggles > summary, .nsda-advanced > summary, .nsda-history summary { cursor: pointer; list-style: none; }
.nsda-section > details > summary::-webkit-details-marker { display: none; }
.nsda-section > details > summary .nsda-h2::before { content: "▾"; display: inline-block; width: 1.1em; color: var(--nsda-blue); transition: transform .15s; }
.nsda-section > details:not([open]) > summary .nsda-h2::before { transform: rotate(-90deg); }
.nsda-h2 { font-size: calc(1.3em * var(--nsda-h-scale)); color: var(--nsda-navy); border-bottom: 1px solid var(--nsda-line); padding-bottom: .35em; margin: 1.25em 0 .75em; }
.nsda-h3 { font-size: calc(1.1em * var(--nsda-h-scale)); color: var(--nsda-navy); margin: 1.1em 0 .5em; }
.nsda-h4 { font-size: 1em; color: var(--nsda-navy); margin: 1em 0 .4em; }
.nsda-secnum { color: var(--nsda-blue); }
.nsda-top { text-align: right; font-size: .8em; margin: .25em 0 0; }
.nsda-small { font-size: .85em; }

/* Tables */
.nsda-doc table, .nsda-portal table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: .92em; background: var(--nsda-bg); }
.nsda-doc th, .nsda-doc td, .nsda-portal th, .nsda-portal td { border: 1px solid var(--nsda-line); padding: .5em .6em; vertical-align: top; text-align: left; }
.nsda-doc thead th, .nsda-portal thead th { background: var(--nsda-th); color: var(--nsda-navy); }
.nsda-kv th { width: 28%; background: var(--nsda-soft); font-weight: 600; }
.nsda-group th, .nsda-group td { background: #eef5ea; }
.nsda-total td { font-weight: 700; background: #f7f7f7; }
.nsda-grand td { background: var(--nsda-th); }
.nsda-versions tr.is-active td { background: #fffbe6; }
.nsda-doc td > p:last-child { margin-bottom: 0; }
@media (max-width: 720px) {
  .nsda-doc table, .nsda-doc thead, .nsda-doc tbody, .nsda-doc tr, .nsda-doc th, .nsda-doc td { display: block; width: 100% !important; }
  .nsda-doc thead { display: none; }
  .nsda-doc tr { border: 1px solid var(--nsda-line); margin-bottom: .6em; }
  .nsda-doc th, .nsda-doc td { border: 0; border-bottom: 1px solid #eef1f4; }
}
ol.nsda-ol { list-style: none; margin: 0; padding: 0; }
ol.nsda-ol li { padding-left: 2.4em; text-indent: -2.4em; margin: 0 0 .2em; }
.nsda-n { font-weight: 700; color: var(--nsda-navy); display: inline-block; min-width: 2.2em; text-indent: 0; }
ul.nsda-ul { margin: 0 0 0 1.1em; padding: 0; }
.nsda-rv { font-weight: 700; }
.nsda-unit-block { border-top: 3px solid var(--nsda-blue); padding-top: .75em; margin: 1.5em 0; }

/* TOC + toggles */
.nsda-toc, .nsda-toggles { border: 1px solid var(--nsda-line); background: var(--nsda-soft); border-radius: var(--nsda-radius); padding: .6em .9em; margin: 0 0 1em; }
.nsda-toc ol { list-style: none; margin: .5em 0 0; padding: 0; columns: 2 18em; }
.nsda-toc li { margin: 0 0 .2em; }
.nsda-toggles > summary { font-weight: 700; color: var(--nsda-blue); }
.nsda-toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16em, 1fr)); gap: .35em 1em; margin: .75em 0; }
.nsda-switch { display: flex; align-items: center; gap: .55em; cursor: pointer; font-size: var(--nsda-form-size); }
.nsda-switch input { appearance: none; -webkit-appearance: none; width: 2.3em; height: 1.3em; border-radius: 999px; background: #c2cad3; position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s; }
.nsda-switch input::after { content: ""; position: absolute; top: .15em; left: .15em; width: 1em; height: 1em; border-radius: 50%; background: var(--nsda-bg); transition: left .15s; }
.nsda-switch input:checked { background: var(--nsda-green); }
.nsda-switch input:checked::after { left: 1.15em; }
.nsda-switch input:focus-visible { outline: 2px solid var(--nsda-blue); outline-offset: 2px; }

/* Search */
.nsda-hero h2 { margin: 0 0 .25em; color: var(--nsda-navy); }
.nsda-search-form { background: var(--nsda-soft); border: 1px solid var(--nsda-line); font-size: var(--nsda-form-size); border-radius: var(--nsda-radius); padding: 1em; margin: 1em 0; }
.nsda-simple { display: flex; gap: .5em; }
.nsda-simple input[type=search] { flex: 1; min-width: 0; padding: .65em .9em; border: 1px solid var(--nsda-line); border-radius: var(--nsda-radius); font-size: var(--nsda-form-size); background: var(--nsda-bg); color: var(--nsda-text); }
.nsda-advanced { margin-top: .75em; }
.nsda-advanced > summary { color: var(--nsda-blue); font-weight: 600; }
.nsda-adv-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, 1.4fr); gap: 1.1em 1.6em; margin-top: 1em; }
.nsda-f { display: flex; align-items: center; gap: .5em; }
.nsda-f label { white-space: nowrap; font-size: var(--nsda-form-size); color: var(--nsda-text); }
.nsda-f label::after { content: ""; }
.nsda-f input, .nsda-f select { flex: 1; min-width: 0; padding: .45em .65em; border: 1px solid var(--nsda-line); border-radius: var(--nsda-radius); background: var(--nsda-bg); font-size: var(--nsda-form-size); color: var(--nsda-text); min-height: 2.6em; font-family: inherit; }
.nsda-f select:invalid, .nsda-f select option[value=""] { color: #9aa1a9; }
@media (max-width: 900px) { .nsda-adv-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .nsda-adv-grid { grid-template-columns: 1fr; } .nsda-f { flex-direction: column; align-items: stretch; } }
.nsda-adv-actions { margin: 1em 0 0; }
.nsda-results-wrap { min-height: 3em; transition: opacity .15s; }
.nsda-results-wrap.is-loading { opacity: .45; }
.nsda-results-head { margin: .5em 0; }
ol.nsda-results { list-style: none; margin: 0; padding: 0; }
.nsda-result { border: 1px solid var(--nsda-line); border-radius: var(--nsda-radius); padding: .75em 1em; margin: 0 0 .6em; background: var(--nsda-bg); }
.nsda-result-title { font-weight: 700; font-size: 1.05em; text-decoration: none; }
.nsda-result-meta { font-size: .85em; color: var(--nsda-muted); margin: .2em 0; }
.nsda-hits { margin: .4em 0 0 1em; padding: 0; font-size: .88em; }
.nsda-hits li { margin: .15em 0; }
.nsda-hits mark, .nsda-results mark { background: #ffe58a; padding: 0 .1em; }
.nsda-type { display: inline-block; font-size: .72em; font-weight: 700; letter-spacing: .03em; padding: .1em .45em; border-radius: 3px; background: #e8eef5; color: var(--nsda-navy); text-decoration: none; text-transform: uppercase; vertical-align: middle; }
.nsda-type.t-cs { background: #dbeafe; color: #1e3a8a; }
.nsda-type.t-cbc { background: #dcfce7; color: #14532d; }
.nsda-type.t-cad { background: #fef3c7; color: #78350f; }
.nsda-type.t-unit { background: #ede9fe; color: #4c1d95; }
.nsda-type.t-mod { background: #fce7f3; color: #831843; }
.nsda-type.is-missing { background: #f1f1f1; color: #aaa; text-decoration: line-through; }
.nsda-pager { display: flex; gap: .35em; flex-wrap: wrap; margin: 1em 0; }
.nsda-pager a, .nsda-pager span { padding: .3em .65em; border: 1px solid var(--nsda-line); border-radius: 3px; text-decoration: none; }
.nsda-pager .current { background: var(--nsda-blue); color: #fff; border-color: var(--nsda-blue); }

/* Occupation browser */
.nsda-occ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: .75em; }
.nsda-occ-card { border: 1px solid var(--nsda-line); border-radius: var(--nsda-radius); padding: .75em .9em; background: var(--nsda-bg); }
.nsda-occ-card h4 { margin: 0 0 .2em; font-size: 1em; }
.nsda-occ-card p { margin: .2em 0; }
.nsda-docbadges { display: flex; gap: .3em; }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }

@media print {
  .nsda-actions, .nsda-toggles, .nsda-tabs, .nsda-search-form, .nsda-top, .nsda-breadcrumb { display: none !important; }
  .nsda-section details > *:not(summary) { display: block !important; }
}

/* Use the theme's wide width when available; keep wide tables scrollable on small screens. */
.nsda-doc.alignwide, .nsda-portal.alignwide { max-width: var(--wp--style--global--wide-size, 1200px); margin-left: auto !important; margin-right: auto !important; }
.nsda-doc .nsda-portal, .nsda-portal .nsda-portal { max-width: none; }

/* Form text size */
.nsda-search-form .nsda-btn, .nsda-toggle-form .nsda-btn { font-size: calc(var(--nsda-form-size) * .95); }
.nsda-advanced > summary, .nsda-toggles > summary { font-size: var(--nsda-form-size); }

/* Unit title (plain text, no link) */
.nsda-unit-title { font-size: 1.05em; color: var(--nsda-navy); }

/* Linked unit / module lists inside occupation pages */
ol.nsda-linklist { list-style: none; margin: 0 0 1.2em; padding: 0; display: grid; gap: .5em; }
.nsda-linkcard { display: flex; align-items: center; gap: .9em; padding: .75em 1em; border: 1px solid var(--nsda-line); border-radius: var(--nsda-radius); background: var(--nsda-bg); text-decoration: none !important; color: var(--nsda-text) !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
.nsda-linkcard:hover, .nsda-linkcard:focus { border-color: var(--nsda-blue); box-shadow: 0 2px 10px rgba(0,0,0,.08); transform: translateY(-1px); }
.nsda-lc-num { flex: none; width: 2em; height: 2em; border-radius: 50%; background: var(--nsda-soft); color: var(--nsda-blue); display: grid; place-items: center; font-weight: 700; font-size: .9em; }
.nsda-lc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.nsda-lc-main .nsda-code { font-size: .8em; color: var(--nsda-muted); }
.nsda-lc-main strong { color: var(--nsda-navy); font-family: var(--nsda-head-font); }
.nsda-lc-main small { color: var(--nsda-muted); }
.nsda-lc-meta { flex: none; font-size: .85em; color: var(--nsda-muted); white-space: nowrap; }
.nsda-lc-go { flex: none; font-size: 1.6em; line-height: 1; color: var(--nsda-blue); }
@media (max-width: 640px) { .nsda-lc-meta { display: none; } }

/* Unit / module loaded inside the occupation page */
.nsda-itemnav { display: flex; flex-wrap: wrap; align-items: center; gap: .6em; margin: .5em 0 1em; }
.nsda-itemnav-pos { color: var(--nsda-muted); font-size: .9em; }
.nsda-itemnav-pn { margin-left: auto; display: flex; gap: .5em; }
.nsda-item-head { border-left: 5px solid var(--nsda-blue); padding: .4em 0 .4em 1em; margin: 0 0 1em; }
.nsda-item-title { margin: .1em 0 .4em; font-size: calc(1.5em * var(--nsda-h-scale)); color: var(--nsda-navy); line-height: 1.25; }
.nsda-item-title .nsda-code { display: block; font-size: .55em; color: var(--nsda-muted); font-weight: 600; }
.nsda-unit-embedded .nsda-section { margin-top: 0; }

/* ---------- NSDA document layout (matches the printed CS / CBC / CAD) ---------- */
.nsda-doc-banner { text-align: center; font-weight: 700; font-family: var(--nsda-head-font); color: var(--nsda-navy); font-size: 1.08em; max-width: 46em; margin: 1.6em auto 1em; line-height: 1.45; }
.nsda-center { text-align: center !important; }
.nsda-right { text-align: right !important; }
.nsda-doc caption.nsda-caption, .nsda-caption { caption-side: top; text-align: center; font-weight: 700; font-family: var(--nsda-head-font); color: var(--nsda-navy); padding: .4em 0 .5em; font-size: 1.02em; }
.nsda-doc table.nsda-glance, .nsda-doc table.nsda-structure { margin-bottom: 1.6em; }
.nsda-unit-table { table-layout: fixed; }
.nsda-unit-table > tbody > tr > th[scope=row] { background: var(--nsda-soft); font-weight: 700; color: var(--nsda-navy); vertical-align: top; }
.nsda-unit-table .nsda-ut-head th { background: var(--nsda-th); color: var(--nsda-navy); font-weight: 700; }
.nsda-unit-table .nsda-ut-head small { font-weight: 600; }
.nsda-unit-table .nsda-ut-band th { background: var(--nsda-navy); color: var(--nsda-bg); text-align: left; font-size: 1.02em; letter-spacing: .01em; }
.nsda-unit-table .nsda-ut-left { font-weight: 600; color: var(--nsda-navy); }
.nsda-unit-table .nsda-ut-note { font-size: .92em; color: var(--nsda-muted); font-style: italic; }
.nsda-unit-table .nsda-ut-sub { margin: 0 0 .3em; font-weight: 600; }
.nsda-unit-table .nsda-unit-title { font-size: 1.08em; }
.nsda-unit-block { border-top: 0; padding-top: 0; }
.nsda-unit-block + .nsda-unit-block { margin-top: 2.2em; }

/* Chips, citation */
.nsda-chips { display: flex; flex-wrap: wrap; gap: .45em; }
.nsda-chip { display: inline-block; padding: .3em .8em; border: 1px solid var(--nsda-line); border-radius: 999px; background: var(--nsda-soft); color: var(--nsda-navy) !important; text-decoration: none !important; font-size: .92em; }
.nsda-chip:hover, .nsda-chip:focus { border-color: var(--nsda-blue); }
.nsda-chip.is-active { background: var(--nsda-blue); border-color: var(--nsda-blue); color: var(--nsda-bg) !important; }
.nsda-chip small { opacity: .75; }
.nsda-cite { margin: .5em 0 0; }
.nsda-cite > summary { cursor: pointer; color: var(--nsda-blue); font-weight: 600; }
.nsda-cite code { display: block; white-space: normal; background: var(--nsda-soft); border: 1px solid var(--nsda-line); padding: .7em .9em; border-radius: var(--nsda-radius); font-size: .88em; user-select: all; }

/* Tooltips — CSS only, keyboard accessible (focus) */
.nsda-doc [data-tip], .nsda-portal [data-tip] { position: relative; }
.nsda-doc [data-tip]:hover::after, .nsda-doc [data-tip]:focus-visible::after, .nsda-portal [data-tip]:hover::after, .nsda-portal [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%); z-index: 50;
  width: max-content; max-width: 18em; padding: .5em .75em; border-radius: 6px; background: #1d2327; color: #fff; font: 400 13px/1.45 system-ui, sans-serif; text-align: left; white-space: normal; text-transform: none; letter-spacing: 0; box-shadow: 0 6px 18px rgba(0,0,0,.18); pointer-events: none; }
.nsda-doc [data-tip]:hover::before, .nsda-doc [data-tip]:focus-visible::before, .nsda-portal [data-tip]:hover::before, .nsda-portal [data-tip]:focus-visible::before {
  content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%); border: 6px solid transparent; border-top-color: #1d2327; border-bottom: 0; z-index: 51; pointer-events: none; }
.nsda-tip { display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; margin-left: .3em; border-radius: 50%; background: var(--nsda-blue); color: var(--nsda-bg); font-size: .75em; font-weight: 700; cursor: help; vertical-align: middle; }

/* Portal stats + recent */
.nsda-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9em, 1fr)); gap: .7em; margin: 1em 0 1.4em; }
.nsda-stat { border: 1px solid var(--nsda-line); border-radius: var(--nsda-radius); padding: .8em 1em; background: var(--nsda-bg); }
.nsda-stat b { display: block; font-size: 1.7em; line-height: 1.1; color: var(--nsda-blue); font-family: var(--nsda-head-font); }
.nsda-stat span { color: var(--nsda-muted); font-size: .9em; }
.nsda-recent { list-style: none; margin: 0; padding: 0; }
.nsda-recent li { display: flex; gap: .6em; align-items: baseline; padding: .55em 0; border-bottom: 1px solid var(--nsda-line); flex-wrap: wrap; }
.nsda-recent time { margin-left: auto; color: var(--nsda-muted); font-size: .88em; }
.nsda-filterbar { display: grid; gap: .6em; margin: 0 0 1em; }
.nsda-filterbar .nsda-az a, .nsda-filterbar .nsda-az span { display: inline-grid; place-items: center; min-width: 2em; height: 2em; margin: 0 .15em .2em 0; border-radius: var(--nsda-radius); border: 1px solid var(--nsda-line); text-decoration: none; font-weight: 600; }
.nsda-filterbar .nsda-az .is-active { background: var(--nsda-blue); color: var(--nsda-bg); border-color: var(--nsda-blue); }
.nsda-filterbar .nsda-az span.is-empty { opacity: .35; }
.nsda-viewswitch { display: flex; gap: .45em; flex-wrap: wrap; margin: 0 0 1em; }
.nsda-incomplete { display: inline-block; margin-left: .4em; padding: .05em .5em; border-radius: 999px; background: #fff4e0; color: #8a4b08; border: 1px solid #f0c98a; font-size: .85em; font-weight: 600; }
.nsda-unit-open { text-align: right; margin: 0 0 .3em; font-size: .9em; }
