/* ui/qi_integration_config.css — WGS-74.

   QI PROGRAM INTEGRATION CONFIGURATION PAGE.
   Hierarchy: System > API > Form Response, per QI.

   TOKENS: --qic-* prefixed so gate_css_namespace stays green.
   THE SAME DUAL-ROOT RULE as integrations.css applies here: if a panel is
   portalled to body, CSS vars defined only on .qic-wrap will silently resolve
   to nothing and make controls invisible. Both .qic-wrap and .qic-panel carry
   the full token set (gate_css_vars enforces every var() is defined). */

.qic-wrap, .qic-panel {
  --qic-depth: #271257;
  --qic-indigo: #4330F5;
  --qic-manage: #581C87;
  --qic-line: #E5E7EB;
  --qic-muted: #6B7280;
  --qic-ink: #111827;
  --qic-green-bg: #e7f7ee;
  --qic-green-fg: #0b8a4b;
  --qic-amber-bg: rgb(255,251,235);
  --qic-amber-fg: rgb(180,83,9);
  --qic-red-bg: #FEF2F2;
  --qic-red-fg: #B91C1C;
  font-family: Poppins, system-ui, sans-serif;
  color: var(--qic-ink);
}

/* ---------- header ---------- */
.qic-head { display: flex; justify-content: space-between; align-items: flex-end;
            gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.qic-h1 { font-family: var(--font-head, 'Sansation', 'Poppins', sans-serif);
           font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.qic-sub { color: var(--qic-muted); font-size: 13px; margin: 4px 0 0; }

/* ---------- facility selector ---------- */
.qic-fac-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
               padding: 12px 16px; background: #F9FAFB; border: 0.67px solid var(--qic-line);
               border-radius: 10px; flex-wrap: wrap; }
.qic-fac-label { font-size: 12px; font-weight: 600; color: var(--qic-muted);
                 text-transform: uppercase; letter-spacing: .04em; flex: none; }
.qic-fac-sel { height: 36px; border: 1px solid var(--qic-line); border-radius: 8px;
               padding: 0 12px; font-size: 13px; font-family: Poppins, sans-serif;
               background: #FFF; color: var(--qic-ink); cursor: pointer; min-width: 220px; }
.qic-fac-sel:focus { outline: 2px solid var(--qic-indigo); outline-offset: -1px; }
.qic-fac-override-badge { font-size: 11px; font-weight: 600; padding: 2px 8px;
                           border-radius: 9999px; background: #EEEBFF; color: var(--qic-depth); }

/* ---------- summary bar ---------- */
.qic-summary { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.qic-stat { font-size: 12px; color: var(--qic-muted); }
.qic-stat b { font-family: var(--font-head, 'Sansation', 'Poppins', sans-serif);
               font-size: 18px; font-weight: 700; color: var(--qic-ink); margin-right: 4px; }

/* ---------- QI cards ---------- */
.qic-list { display: flex; flex-direction: column; gap: 8px; }

.qic-item { background: #FFF; border: 0.67px solid var(--qic-line); border-radius: 12px;
            overflow: hidden; }
.qic-item.is-off { background: #FAFAFA; }
.qic-item.has-override { border-color: #C4B5FD; }

/* top row: toggle + name + lane badge + expand */
.qic-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
           cursor: pointer; user-select: none; }
.qic-row:hover { background: #F9FAFB; }
.qic-item.is-off .qic-row:hover { background: #F5F5F5; }

/* toggle */
.qic-toggle { position: relative; width: 40px; height: 22px; flex: none; }
.qic-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.qic-toggle-track { display: block; width: 40px; height: 22px; border-radius: 11px;
                    background: var(--qic-line); transition: background .15s; cursor: pointer; }
.qic-toggle input:checked + .qic-toggle-track { background: var(--qic-depth); }
.qic-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
                    border-radius: 50%; background: #FFF; pointer-events: none;
                    transition: transform .15s; }
.qic-toggle input:checked ~ .qic-toggle-thumb { transform: translateX(18px); }

.qic-qi-num { font-size: 11px; font-weight: 700; color: var(--qic-muted); flex: none;
              min-width: 26px; }
.qic-qi-name { font-size: 14px; font-weight: 600; flex: 1; }
.qic-item.is-off .qic-qi-name { color: var(--qic-muted); }

.qic-lane-pill { font-size: 10px; font-weight: 600; text-transform: uppercase;
                 letter-spacing: .04em; padding: 2px 8px; border-radius: 9999px;
                 flex: none; }
.qic-lane-pill.clinical { background: #EFF6FF; color: #1D4ED8; }
.qic-lane-pill.pharmacy { background: #F0FDF4; color: #15803D; }
.qic-lane-pill.rostering { background: #FFF7ED; color: #C2410C; }
.qic-lane-pill.allied { background: #F5F3FF; color: var(--qic-manage); }
.qic-lane-pill.survey { background: #ECFEFF; color: #0E7490; }

.qic-override-dot { width: 8px; height: 8px; border-radius: 50%;
                    background: var(--qic-depth); flex: none; }

.qic-chevron { font-size: 12px; color: var(--qic-muted); flex: none; transition: transform .2s; }
.qic-item.is-open .qic-chevron { transform: rotate(90deg); }

/* ---------- tree (System > API > Form Response) ---------- */
.qic-tree { display: none; padding: 0 16px 16px 16px; }
.qic-item.is-open .qic-tree { display: block; }

/* manual-entry notice when api_enabled is off */
.qic-manual-notice { font-size: 13px; color: var(--qic-muted); padding: 10px 14px;
                     background: #F9FAFB; border-radius: 8px; border: 0.67px solid var(--qic-line);
                     margin-bottom: 8px; }

/* tree levels */
.qic-level { margin: 0; padding: 0; list-style: none; }
.qic-level-system > li { margin-bottom: 10px; }
.qic-level-api { margin: 6px 0 4px 20px; }
.qic-level-form { margin: 4px 0 0 40px; font-size: 12px; color: var(--qic-muted); }
.qic-level-form li { padding: 2px 0; }
.qic-level-form li::before { content: "▸ "; font-size: 10px; }

.qic-node { display: flex; align-items: flex-start; gap: 10px; font-size: 13px;
            padding: 8px 12px; border-radius: 8px; border: 0.67px solid var(--qic-line);
            background: #FFF; }
.qic-node-icon { font-size: 16px; flex: none; margin-top: 1px; }
.qic-node-body { flex: 1; min-width: 0; }
.qic-node-label { font-weight: 600; color: var(--qic-ink); }
.qic-node-sub { font-size: 11.5px; color: var(--qic-muted); margin-top: 2px; line-height: 1.45; }
.qic-node-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* system-selector dropdown inside tree */
.qic-sys-sel { height: 34px; border: 1px solid var(--qic-line); border-radius: 8px;
               padding: 0 10px; font-size: 12px; font-family: Poppins, sans-serif;
               background: #FFF; color: var(--qic-ink); cursor: pointer; }
.qic-sys-sel:focus { outline: 2px solid var(--qic-indigo); outline-offset: -1px; }

/* instance selector */
.qic-inst-sel { height: 34px; border: 1px solid var(--qic-line); border-radius: 8px;
                padding: 0 10px; font-size: 12px; font-family: Poppins, sans-serif;
                background: #FFF; color: var(--qic-ink); cursor: pointer; }

/* save button inside tree row */
.qic-save-btn { height: 34px; border-radius: 8px; font-weight: 600; font-size: 12px;
                cursor: pointer; font-family: Poppins, sans-serif; background: var(--qic-depth);
                color: #FFF; border: 0; padding: 0 16px; }
.qic-save-btn:hover { background: var(--qic-indigo); }
.qic-save-btn:disabled { opacity: .5; cursor: not-allowed; }

/* facility-override pill inside tree */
.qic-fac-override-row { display: flex; align-items: center; gap: 8px; margin-top: 10px;
                         padding: 8px 12px; background: #EEEBFF; border-radius: 8px; }
.qic-fac-override-label { font-size: 12px; font-weight: 600; color: var(--qic-depth); flex: 1; }
.qic-clear-fac-btn { font-size: 11px; font-weight: 600; color: var(--qic-amber-fg);
                     background: #FFF; border: 1px solid var(--qic-amber-fg);
                     border-radius: 6px; padding: 2px 10px; cursor: pointer; }
.qic-clear-fac-btn:hover { background: var(--qic-amber-bg); }

/* status feedback */
.qic-saved-ok { font-size: 12px; color: var(--qic-green-fg); background: var(--qic-green-bg);
                border-radius: 6px; padding: 4px 10px; display: none; }
.qic-saved-ok.is-visible { display: inline-block; }

/* WGS-115/WGS-125: auto-save status pill — same shape as .qic-q-avail.
   Fallback hex values ensure these render outside .qic-wrap/.qic-panel contexts
   (e.g. Care Minutes #cmxWrap, RN247, AN-ACC, QFR/ACFR). */
.as-status { display: none; font-size: 10.5px; font-weight: 700;
             border-radius: 999px; padding: 2px 9px; white-space: nowrap;
             border: 1px solid transparent; transition: opacity .3s; }
.as-status--pending,
.as-status--saving  { display: inline-block; color: #92600a; background: #fef9ec;
                      border-color: #f3d78c; }
.as-status--saved   { display: inline-block;
                      color: var(--qic-green-fg, #0b8a4b);
                      background: var(--qic-green-bg, #e7f7ee);
                      border-color: #b8e6cd; }
.as-status--err     { display: inline-block; color: var(--qic-red-fg, #B91C1C);
                      background: var(--qic-red-bg, #FEF2F2); border-color: #fecdd3; }

/* ---------- error boundary ---------- */
.qic-err { text-align: center; padding: 48px 24px; }

@media (max-width: 640px) {
  .qic-summary { flex-direction: column; gap: 8px; }
  .qic-row { flex-wrap: wrap; }
}


/* WGS-74 delta: prefill mode selector + menu counts */
.qic-mode { margin: 10px 0 14px; }
.qic-mode-label { font-size: 13px; font-weight: 600; color: #271257; margin-bottom: 6px; }
.qic-mode-seg { display: inline-flex; border: 1px solid #d9d5e6; border-radius: 8px; overflow: hidden; }
.qic-mode-btn { border: 0; background: #fff; padding: 7px 14px; font-size: 13px; cursor: pointer; color: #4a4a55; border-right: 1px solid #eceaf3; }
.qic-mode-btn:last-child { border-right: 0; }
.qic-mode-btn.is-active { background: #271257; color: #fff; }
.qic-mode-sub { font-size: 12px; color: #6a6a78; margin-top: 6px; }
.qic-mode-upload { display: none; gap: 12px; align-items: center; margin-top: 8px; }
.qic-tmpl-link { color: #271257; font-size: 12px; font-weight: 600; text-decoration: underline; }
.qic-upload-input { font-size: 12px; }


/* WGS-74: form-response data tree */
.qic-data { margin: 8px 0 4px; border-top: 1px dashed #e3ddf3; padding-top: 10px; }
.qic-data-label { font-size: 12px; font-weight: 600; color: #271257; margin-bottom: 6px; }
.qic-api-head { font-size: 13px; font-weight: 600; color: #3a2a6e; cursor: pointer; padding: 5px 6px; border-radius: 6px; }
.qic-api-head:hover { background: #f4f2fb; }
.qic-forms { margin-left: 14px; }
.qic-form-head { font-size: 12.5px; color: #4a4a55; cursor: pointer; padding: 4px 6px; }
.qic-form-head:hover { background: #f7f6fb; }
.qic-resps { margin-left: 16px; padding: 2px 0 6px; }
.qic-resp { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #4a4a55; padding: 3px 6px; cursor: pointer; }
.qic-resp:hover { background: #f7f6fb; border-radius: 5px; }
.qic-resp-id { flex: 1; }
.qic-resp-cnt { font-size: 11px; color: #8a8a95; font-variant-numeric: tabular-nums; }


/* ===== Loop IQ iOS-style config UI pack (WGS-91) ===== */
.qic-ios { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: #1c1c28; }
.qic-ios .qic-h1 { font-size: 22px; font-weight: 600; margin: 0 0 2px; letter-spacing: -0.2px; }
.qic-ios .qic-sub { font-size: 13.5px; color: #6b6b78; margin: 0 0 18px; }
.ios-card { background: #fff; border: 1px solid #ececf1; border-radius: 16px; padding: 18px 20px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(20,20,40,.03); }
.ios-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; color: #1c1c28; }
.ios-sub { font-size: 12.5px; color: #8a8a95; margin-bottom: 12px; }
.ios-list { display: flex; flex-direction: column; }
.ios-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid #f2f2f6; }
.ios-row:last-child { border-bottom: 0; }
.ios-row-main { display: flex; flex-direction: column; gap: 2px; }
.ios-row-title { font-size: 14px; font-weight: 500; }
.ios-row-meta { font-size: 11.5px; color: #9a9aa6; }
.ios-switch { width: 50px; height: 30px; border-radius: 20px; background: #e4e4ea; position: relative; transition: background .2s ease; flex-shrink: 0; cursor: pointer; }
.ios-switch.on { background: #271257; }
.ios-switch-knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s ease; }
.ios-switch.on .ios-switch-knob { left: 23px; }
.qic-domains { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.qic-domain-top { display: flex; justify-content: space-between; align-items: baseline; }
.qic-domain-name { font-size: 16px; font-weight: 600; }
.qic-domain-count { font-size: 11.5px; color: #9a9aa6; }
.qic-domain-src { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.qic-domain-dot { width: 8px; height: 8px; border-radius: 50%; background: #c8c8d0; }
.qic-domain-dot.on { background: #1d9e75; }
.qic-domain-srcname { font-size: 14px; font-weight: 500; color: #271257; }
.ios-badge { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: #f0eef8; color: #271257; }
.ios-badge-gov { background: #e6f1fb; color: #0c447c; }
.qic-domain-btn { border: 0; background: #f6f5fb; color: #271257; font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.qic-domain-btn:hover { background: #efedf8; }
.qic-domain-detail { margin-top: 12px; }
.qic-proda-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
@media (max-width: 720px) { .qic-domains { grid-template-columns: 1fr; } }

/* ===== WGS-91: Configure Questions drill-down - iOS pack polish ===== */
.qic-ios .qic-item { background:#fff; border:1px solid #ececf1; border-radius:12px; margin:0 0 10px; overflow:hidden; transition:border-color .15s ease, box-shadow .15s ease; }
.qic-ios .qic-item.is-open { border-color:#d9d5e6; box-shadow:0 2px 8px rgba(39,18,87,.06); }
.qic-ios .qic-item.is-off { opacity:.7; }
.qic-ios .qic-row { display:flex; align-items:center; gap:12px; padding:13px 16px; cursor:pointer; }
.qic-ios .qic-row:hover { background:#faf9fd; }
.qic-ios .qic-qi-num { font-size:11px; font-weight:700; color:#271257; background:#f0eef8; padding:3px 8px; border-radius:6px; flex-shrink:0; letter-spacing:.02em; }
.qic-ios .qic-qi-name { font-size:14px; font-weight:500; color:#1c1c28; flex:1; line-height:1.35; }
.qic-ios .qic-chevron { width:8px; height:8px; border-right:2px solid #b8b8c4; border-bottom:2px solid #b8b8c4; transform:rotate(-45deg); transition:transform .2s ease; flex-shrink:0; margin-right:2px; }
.qic-ios .qic-item.is-open .qic-chevron { transform:rotate(45deg); }
.qic-ios .qic-override-dot { width:8px; height:8px; border-radius:50%; background:#d4537e; flex-shrink:0; }
.qic-ios .qic-lane-pill { font-size:10.5px; font-weight:600; padding:3px 9px; border-radius:20px; background:#eef0f6; color:#4a4a63; flex-shrink:0; }
.qic-ios .qic-toggle { position:relative; width:50px; height:30px; flex-shrink:0; cursor:pointer; display:inline-block; }
.qic-ios .qic-toggle input { position:absolute; inset:0; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; z-index:2; }
.qic-ios .qic-toggle-track { position:absolute; inset:0; border-radius:20px; background:#e4e4ea; transition:background .2s ease; }
.qic-ios .qic-toggle input:checked ~ .qic-toggle-track { background:#271257; }
.qic-ios .qic-toggle-thumb { position:absolute; top:3px; left:3px; width:24px; height:24px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.2); transition:left .2s ease; z-index:1; }
.qic-ios .qic-toggle input:checked ~ .qic-toggle-thumb { left:23px; }
.qic-ios .qic-tree { padding:6px 16px 16px; border-top:1px solid #f2f2f6; }

/* ===== WGS-93: unified P>C>GC>GGC hierarchy - one consistent indented drill ===== */
.qic-ios .qic-tree { position: relative; padding: 10px 18px 18px; }
.qic-ios .qic-data { margin: 6px 0 2px; }
.qic-ios .qic-data-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #9a90c0; margin-bottom: 8px; }
.qic-ios .qic-api, .qic-ios .qic-forms, .qic-ios .qic-resps { margin-left: 16px; padding-left: 16px; border-left: 2px solid #efeaf7; }
.qic-ios .qic-api-head, .qic-ios .qic-form-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin: 4px 0; border-radius: 10px; background: #faf9fd; border: 1px solid #efedf5; font-size: 13px; font-weight: 500; color: #3a2a6e; cursor: pointer; transition: background .12s ease, border-color .12s ease; }
.qic-ios .qic-api-head:hover, .qic-ios .qic-form-head:hover { background: #f4f2fb; border-color: #e3ddf3; }
.qic-ios .qic-form-head { font-weight: 400; color: #4a4a55; background: #fcfbfe; }
.qic-ios .qic-resp { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 3px 0; border-radius: 8px; font-size: 12.5px; color: #4a4a55; cursor: pointer; transition: background .12s ease; }
.qic-ios .qic-resp:hover { background: #f6f5fb; }
.qic-ios .qic-resp input[type="radio"] { accent-color: #271257; width: 16px; height: 16px; margin: 0; }
.qic-ios .qic-resp-id { flex: 1; }
.qic-ios .qic-resp-cnt { font-size: 11px; color: #9a9aa6; font-variant-numeric: tabular-nums; }
/* level badges via labelled markers on each head */
.qic-ios .qic-api-head::before { content: "API"; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; color: #6b5fa6; background: #ece7f7; padding: 2px 6px; border-radius: 5px; }
.qic-ios .qic-form-head::before { content: "DATA"; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; color: #7a7a88; background: #eeecf3; padding: 2px 6px; border-radius: 5px; }
/* system (parent) node polish + connected correlation */
.qic-ios .qic-node { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid #ececf1; margin-bottom: 6px; }
.qic-ios .qic-node-label { font-size: 14px; font-weight: 600; color: #271257; }
.qic-ios .qic-node-sub { font-size: 12px; color: #8a8a95; margin-top: 2px; }
.qic-ios .qic-sys-sel, .qic-ios .qic-inst-sel { border: 1px solid #d9d5e6; border-radius: 8px; padding: 7px 10px; font-size: 13px; background: #fff; }
.qic-ios .qic-save-btn { background: #271257; color: #fff; border: 0; border-radius: 8px; padding: 8px 16px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.qic-ios .qic-save-btn:hover { background: #3a2a6e; }


/* ===== WGS-100: question-first QI config ===== */
.qic-qfirst .qic-qi-sec { padding: 0; overflow: hidden; }
.qic-qfirst .qic-qi-head { display: flex; align-items: center; gap: 12px; padding: 15px 20px; cursor: pointer; }
.qic-qfirst .qic-qi-head:hover { background: #faf9fd; }
.qic-qfirst .qic-qi-badge { font-size: 11px; font-weight: 700; color: #fff; background: #271257; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.qic-qfirst .qic-qi-title { font-size: 15px; font-weight: 600; flex: 1; color: #1c1c28; }
.qic-qfirst .qic-qi-count { font-size: 12px; color: #9a9aa6; }
.qic-qfirst .qic-qi-chev { width: 8px; height: 8px; border-right: 2px solid #b8b8c4; border-bottom: 2px solid #b8b8c4; transform: rotate(-45deg); transition: transform .2s ease; }
.qic-qfirst .qic-qi-sec.open .qic-qi-chev { transform: rotate(45deg); }
.qic-qfirst .qic-qi-body { border-top: 1px solid #f2f2f6; }
.qic-qfirst .qic-q { padding: 14px 20px; border-bottom: 1px solid #f6f5fb; }
.qic-qfirst .qic-q:last-child { border-bottom: 0; }
.qic-qfirst .qic-q-top { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; flex-wrap: wrap; }
.qic-qfirst .qic-q-id { font-size: 11px; font-weight: 700; color: #6b5fa6; background: #f0eef8; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.qic-qfirst .qic-q-label { font-size: 13.5px; color: #1c1c28; flex: 1; }
.qic-qfirst .qic-q-role { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: #9a9aa6; }
/* Data-available green pill — shown in Automated mode only; hidden in Semi-Auto and Manual. */
.qic-q-avail { margin-left: 8px; font-size: 10.5px; font-weight: 700;
  color: var(--qic-green-fg, #0b8a4b); background: var(--qic-green-bg, #e7f7ee);
  border: 1px solid #b8e6cd; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.qic-qfirst .qic-q-modeseg { display: inline-flex; border: 1px solid #e4e0ee; border-radius: 9px; overflow: hidden; margin-bottom: 12px; }
.qic-qfirst .qic-q-modebtn { border: 0; background: #fff; padding: 7px 14px; font-size: 12.5px; color: #6a6a78; cursor: pointer; border-right: 1px solid #eceaf3; }
.qic-qfirst .qic-q-modebtn:last-child { border-right: 0; }
.qic-qfirst .qic-q-modebtn.on { background: #271257; color: #fff; }
.qic-qfirst .qic-q-cascade { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.qic-qfirst .qic-casc-field { display: flex; flex-direction: column; gap: 4px; }
.qic-qfirst .qic-casc-lbl { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #9a90c0; }
.qic-qfirst .qic-casc-sel { border: 1px solid #d9d5e6; border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; min-width: 150px; }
.qic-qfirst .qic-casc-none { font-size: 12px; color: #8a8a95; padding: 8px 0; }
/* WGS-128: action bar below cascade — holds the auto-save pill */
.qic-qfirst .qic-q-actbar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }


/* ===== WGS-76: Form Response Types (great-grandchild level) ===== */
.qic-rtype-wrap { margin: 6px 0 0 16px; padding-left: 16px; border-left: 2px solid #e8e3f5; }
.qic-rtype-head { display: flex; align-items: center; justify-content: space-between;
                  cursor: pointer; padding: 7px 10px; border-radius: 8px;
                  background: #f8f6fc; border: 1px solid #ece8f6; margin: 4px 0; }
.qic-rtype-head:hover { background: #f2eefc; border-color: #d9d5e6; }
.qic-rtype-title { font-size: 12px; font-weight: 600; color: #3a2a6e; }
.qic-rtype-title::before { content: "TYPE"; font-size: 9px; font-weight: 700;
                            letter-spacing: .04em; color: #9a90c0; background: #ece8f6;
                            padding: 2px 5px; border-radius: 4px; margin-right: 6px; }
.qic-rtype-count { font-size: 11px; color: #9a9aa6; }
.qic-rtype-body { display: none; padding: 4px 0 8px; }
.qic-rtype-body.open { display: block; }
.qic-rtype-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px;
                 border-radius: 7px; font-size: 12px; color: #4a4a55;
                 transition: background .1s; cursor: default; }
.qic-rtype-row:hover { background: #f7f5fc; }
.qic-rtype-row input[type="checkbox"] { accent-color: #271257; width: 15px; height: 15px;
                                         margin: 0; flex: none; cursor: pointer; }
.qic-rtype-label { flex: 1; }
.qic-rtype-kind  { font-size: 10px; font-weight: 600; color: #8a8a95;
                   background: #f0eef8; padding: 1px 6px; border-radius: 4px; flex: none; }
.qic-rtype-cnt   { font-size: 11px; color: #9a9aa6; font-variant-numeric: tabular-nums; flex: none; }
.qic-rtype-indicative { font-size: 10.5px; color: #9a90c0; font-style: italic;
                         margin-top: 4px; padding: 0 10px 4px; }
/* changed-form reconcile banner */
.qic-rtype-changed { font-size: 11px; color: #92600a; background: #fef9ec;
                      border: 1px solid #f3d78c; border-radius: 7px;
                      padding: 5px 10px; margin: 4px 0; }


/* ===== WGS-76: Progress Notes keyword rules ===== */
.qic-pnotes-section { margin-top: 24px; }
.qic-pnotes-head { display: flex; align-items: center; justify-content: space-between;
                   margin-bottom: 12px; }
.qic-pnotes-title { font-size: 15px; font-weight: 600; color: #1c1c28; }
.qic-pnotes-badge { font-size: 10.5px; font-weight: 700; padding: 3px 9px;
                    border-radius: 20px; background: #fff3e0; color: #e65100; margin-left: 8px; }
.qic-pnotes-desc { font-size: 12.5px; color: #6b6b78; margin-bottom: 14px;
                   border-left: 3px solid #e8e3f5; padding-left: 12px; line-height: 1.55; }
/* opt-in toggle row */
.qic-pnotes-optin { display: flex; align-items: center; gap: 12px;
                    padding: 13px 16px; border-radius: 12px;
                    background: #faf9fd; border: 1px solid #ece8f6; margin-bottom: 14px; }
.qic-pnotes-optin-label { flex: 1; font-size: 13.5px; font-weight: 500; }
.qic-pnotes-optin-sub { font-size: 12px; color: #8a8a95; margin-top: 2px; }
/* rules list */
.qic-pnotes-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.qic-pnotes-rule { background: #fff; border: 1px solid #ece8f6; border-radius: 12px;
                   padding: 14px 16px; }
.qic-pnotes-rule-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.qic-pnotes-rule-body { flex: 1; min-width: 0; }
.qic-pnotes-rule-keyword { font-size: 14px; font-weight: 600; color: #271257;
                            font-family: "SF Mono", "Fira Mono", monospace; word-break: break-all; }
.qic-pnotes-rule-meta { font-size: 11.5px; color: #8a8a95; margin-top: 3px; }
.qic-pnotes-rule-del { border: 0; background: transparent; color: #8a8a95; cursor: pointer;
                        font-size: 18px; line-height: 1; padding: 0 4px; flex: none; }
.qic-pnotes-rule-del:hover { color: #b91c1c; }
/* add-rule form */
.qic-pnotes-form { background: #f8f6fc; border: 1px dashed #d9d5e6; border-radius: 12px;
                   padding: 16px; }
.qic-pnotes-form-title { font-size: 13px; font-weight: 600; color: #271257; margin-bottom: 12px; }
.qic-pnotes-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
                         margin-bottom: 12px; }
.qic-pnotes-field { display: flex; flex-direction: column; gap: 4px; }
.qic-pnotes-lbl { font-size: 10px; font-weight: 700; letter-spacing: .04em;
                   text-transform: uppercase; color: #9a90c0; }
.qic-pnotes-inp { border: 1px solid #d9d5e6; border-radius: 8px; padding: 8px 10px;
                  font-size: 13px; background: #fff; font-family: inherit; }
.qic-pnotes-inp:focus { outline: 2px solid #271257; outline-offset: -1px; }
.qic-pnotes-sel { border: 1px solid #d9d5e6; border-radius: 8px; padding: 8px 10px;
                  font-size: 13px; background: #fff; }
.qic-pnotes-add-btn { background: #271257; color: #fff; border: 0; border-radius: 8px;
                       padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; }
.qic-pnotes-add-btn:hover { background: #3a2a6e; }
.qic-pnotes-add-btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 600px) { .qic-pnotes-form-grid { grid-template-columns: 1fr; } }


/* ===== WGS-91: Source palette + domain auto-map cards ===== */
.qic-src-palette { padding: 16px 18px; margin-bottom: 14px; }
.qic-src-palette-head { margin-bottom: 12px; }
.qic-src-palette-title { font-size: 15px; font-weight: 600; color: #1c1c28; display: block; margin-bottom: 3px; }
.qic-src-palette-sub { font-size: 12px; color: #8a8a95; }
.qic-src-list { display: flex; flex-direction: column; gap: 8px; }
.qic-src-card { display: flex; align-items: center; gap: 12px; padding: 11px 14px;
                border: 1px solid #ececf1; border-radius: 12px; background: #faf9fd; }
.qic-src-card-icon { font-size: 20px; flex-shrink: 0; }
.qic-src-card-body { flex: 1; min-width: 0; }
.qic-src-card-name { font-size: 14px; font-weight: 500; color: #1c1c28; }
.qic-src-card-meta { font-size: 11.5px; color: #8a8a95; margin-top: 2px; }

.qic-domain-card { padding: 16px 18px; }
.qic-domain-badge-gov { background: #e6f1fb; color: #0c447c; }
.qic-domain-src-sel { border: 1px solid #d9d5e6; border-radius: 8px; padding: 6px 10px;
                       font-size: 13px; background: #fff; font-family: inherit; cursor: pointer; }
.qic-domain-src-sel:focus { outline: 2px solid #271257; outline-offset: -1px; }

.qic-cfg-hdr { user-select: none; }
.qic-cfg-hdr:hover { background: #faf9fd; }

/* Configure questions expand: match the bottom radius to the last card */
.qic-qi-sec:last-child { border-radius: 0 0 16px 16px !important; }
