/* =====================================================================
   NMA-KIT page (root: #kt_main_content.nma-modern.nma-kt).
   Colours, font and base size come from assets/theme.css. The page's layout
   comes from tools/layouts_KT.py and older rules in style.css, many with inline
   colours, so several overrides here need !important.
   ===================================================================== */

/* ---------- header: title card + controls card (as on the Results page) ---------- */
.nma-kt .ui-hero.kt-hero {
    max-width: none;
    margin: 0 0 1.25em;
}

.nma-kt .kt-hero .ui-hero-text {
    flex: 1 1 28em;
}

.nma-kt .kt-hero .ui-heading {
    font-size: clamp(1.2em, 1.6vw, 1.45em);
}

.nma-kt .kt-protocol-label {
    font-weight: 600;
    color: var(--c-ink);
}

.nma-kt .kt-protocol-link {
    color: var(--c-primary-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.nma-kt a.kt-protocol-link:not([href]) {
    color: var(--c-ink-muted);
    text-decoration: none;
    cursor: default;
}

.nma-kt .ui-card.kt-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1em 3em;
    margin: 0 0 1.25em;
    padding: 1.1em 1.4em;
    border-left: 5px solid var(--c-accent);
}

.nma-kt .kt-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em 1.1em;
}

.nma-kt .kt-control-title {
    margin: 0;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--c-ink);
}

.nma-kt .kt-switch-row {
    display: flex;
    align-items: center;
    gap: 0.7em;
}

.nma-kt .kt-switch-label {
    font-size: 0.92em;
    font-weight: 600;
    color: var(--c-ink);
}

.nma-kt .kt-outcome-select {
    width: 14em;
}

/* the project title is now in the title card: hide the old title rows of both reports */
.nma-kt .row_skt:has(> .title_col1) {
    display: none !important;
}

.nma-kt .kt-note {
    margin: 0 0 1em;
}

.nma-kt .kt-note a {
    color: var(--c-primary-dark);
    font-weight: 600;
    text-decoration: underline;
}

/* ---------- "Select outcome" ---------- */
.nma-kt #outselect_row p,
.nma-kt #outselect_row_simple p {
    color: var(--c-ink) !important;
    font-family: var(--font-ui) !important;
    font-size: 0.95em !important;
    font-weight: 700 !important;
}

.nma-kt .sktdropdown-out {
    min-width: 12em;
}

/* ---------- cards instead of beige / peach / sage panels ---------- */
.nma-kt .row_skt {
    gap: 0.9em;
    margin: 0 0 0.9em !important;
    flex-wrap: nowrap;
}

.nma-kt .title_col1,
.nma-kt .title_col2 {
    background: var(--c-surface) !important;
    border-top: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    min-height: 2.8em;
}

.nma-kt .title_col1 {
    width: auto !important;
    padding: 0 0.6em;
    border-left: 1px solid var(--c-border);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.nma-kt .title_col2 {
    border-right: 1px solid var(--c-border);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-weight: 600;
    color: var(--c-ink);
}

.nma-kt .tab1,
.nma-kt .bodytab1,
.nma-kt .bodytab2,
.nma-kt .skt_studyinfo,
.nma-kt .skt_studyinfo2,
.nma-kt .tab3_col,
.nma-kt .tab3_col2,
.nma-kt .tab2_col,
.nma-kt .slect_body {
    background: var(--c-surface) !important;
}

.nma-kt .tab1,
.nma-kt .skt_studyinfo,
.nma-kt .skt_studyinfo2,
.nma-kt .tab3_col {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.nma-kt .skt_studyinfo {
    height: auto !important;
    min-height: 160px;
    padding: 0.6em 0.8em;
    align-content: start;
    gap: 0.15em;
}

.nma-kt .skt_span1 {
    font-size: 0.88em;
    line-height: 1.6;
    color: var(--c-ink);
}

/* options box: was a dashed red border */
.nma-kt .row_skt > div[style*="dashed"] {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    box-shadow: var(--shadow-sm);
    padding: 0.5em 0.8em;
}

.nma-kt .option_select {
    color: var(--c-ink) !important;
    font-size: 0.95em !important;
}

.nma-kt .select_outcome {
    font-size: 0.85em;
    color: var(--c-ink-muted);
}

.nma-kt #range_lower {
    height: 2.2em;
    padding: 0.25em 0.6em;
    font-family: var(--font-ui);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

/* section labels: brown tabs -> soft teal labels */
.nma-kt .title_first,
.nma-kt .study_design,
.nma-kt .inter_label {
    width: auto !important;
    height: auto !important;
    margin: 0.5em 0.5em 0.4em 0;
    padding: 0.25em 0.75em;
    font-family: var(--font-ui);
    font-size: 0.8em !important;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--c-primary-dark) !important;
    background: var(--c-primary-soft) !important;
    border-radius: 999px !important;
}

/* "Potential effect modifiers Info" heading (inline brown) */
.nma-kt .bodytab2 > .skt_span1:first-child,
.nma-kt .skt_studyinfo .skt_span1[style*="B85042"] {
    color: var(--c-ink) !important;
}

/* ---------- buttons: one look for all (same as the Results panel buttons) ---------- */
.nma-kt .sub-button,
.nma-kt #statsettings,
.nma-kt #treat-instruction-upload,
.nma-kt .kt-file-upload,
.nma-kt #submit {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    height: 34px !important;
    min-height: 0 !important;
    margin: 0;
    padding: 0 14px !important;
    font-family: var(--font-ui) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    font-style: normal !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    white-space: nowrap;
    color: var(--c-primary-dark) !important;
    background: var(--c-surface) !important;
    border: 1px solid #b9dedb !important;
    border-radius: var(--radius-md) !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nma-kt .sub-button:hover:not(:disabled),
.nma-kt #statsettings:hover,
.nma-kt #treat-instruction-upload:hover,
.nma-kt .kt-file-upload:hover,
.nma-kt #submit:hover {
    background: var(--c-primary-soft) !important;
    border-color: var(--c-primary) !important;
}

.nma-kt #treat-instruction-upload a,
.nma-kt #treat-instruction-upload .treat-instruct,
.nma-kt .kt-file-upload a {
    font: inherit !important;
    color: inherit !important;
    text-decoration: none !important;
}

/* Save (PICOS): disabled until the text changes */
.nma-kt .sub-button:disabled {
    opacity: 0.45;
    cursor: default;
}

/* chatbot send button: square, with the arrow */
.nma-kt #submit {
    width: 34px;
    padding: 0 !important;
    font-size: 18px !important;
}

/* info "i" buttons: the same coral button as the Results boxes (.nma-help-button, theme.css) */
.nma-kt .kt-info-button {
    width: 24px;
    height: 24px;
    min-width: 24px;
    margin: 0 0.4em;
    font-size: 15px;
}

.nma-kt #query-title,
.nma-kt #query-PICOS,
.nma-kt #query-diagram,
.nma-kt #query-diagram-advanced,
.nma-kt #query-chatbot {
    display: inline-flex !important;
    align-items: center;
    width: auto !important;
    margin: 0 !important;
    background: transparent !important;
}

/* one "i" per table, above the table */
.nma-kt .kt-table-info {
    display: flex;
    align-items: center;
    gap: 0.2em;
    margin: 0.4em 0 0.6em;
}

.nma-kt .kt-table-info-title {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--c-ink);
}

/* ---------- network graphs: same frame and toolbar as the Results network box ---------- */
.nma-kt #cytoscape_skt,
.nma-kt #cytoscape_skt2 {
    height: 52vh !important;
    margin-top: 0.6em !important;
    border: 1px solid var(--c-border) !important;
    border-radius: var(--radius-md);
    background: #fcfdfe;
}

.nma-kt .kt-graph-head {
    display: flex !important;
    align-items: center;
    gap: 0.2em;
    margin: 0;
}

.nma-kt .kt-network-tools {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    margin: 0.4em 0 0;
    padding-right: 0.8em;
}

.nma-kt .kt-network-tools .results-network-hint {
    margin: 0;
}

/* treatment-names upload / instructions text */
.nma-kt .treat-instruct,
.nma-kt #treat-instruct-span {
    color: var(--c-ink) !important;
}

/* ---------- PICOS text box ---------- */
.nma-kt #picos_textarea_advanced,
.nma-kt #picos_textarea {
    font-family: var(--font-ui);
    font-size: 0.88em;
    color: var(--c-ink);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

/* ---------- results table (AG Grid) ---------- */
.nma-kt .ag-theme-alpine,
.nma-kt .ag-root-wrapper {
    border-color: var(--c-border) !important;
    border-radius: var(--radius-lg);
    font-family: var(--font-ui) !important;
}

.nma-kt .ag-header,
.nma-kt .ag-header-row,
.nma-kt .ag-header-cell {
    background: var(--c-canvas) !important;
    color: var(--c-ink) !important;
}

.nma-kt .ag-header-cell-text {
    font-weight: 700;
    color: var(--c-ink) !important;
}

/* ---------- expert committee footer ---------- */
.nma-kt #sky_expert_page .markdown_style_main,
.nma-kt #sky_expert_page .markdown_style_main * {
    color: var(--c-ink) !important;
    font-family: var(--font-ui) !important;
    border-color: var(--c-border) !important;
}

/* ---------- leftovers ---------- */
/* info cell next to "Project title" (sage block in style.css) */
.nma-kt #query-title {
    width: auto !important;
    background: transparent !important;
    display: flex;
    align-items: center;
}

/* project title text: no sage highlight */
.nma-kt #title_skt,
.nma-kt #title_skt_advacned {
    background: transparent !important;
    font-weight: 600;
    color: var(--c-ink);
}

/* effect-modifier card: wide enough for its text */
.nma-kt .row_skt > div[style*="width: 15%"] {
    width: auto !important;
    min-width: 15em;
    flex: 0 0 auto;
}

/* options card: no second frame around the inner box */
.nma-kt .row_skt > div[style*="dashed"] .skt_studyinfo2 {
    border: none !important;
    box-shadow: none;
    border-radius: 0 !important;
}

/* brown-red text and divider lines set inline -> theme colours */
.nma-kt [style*="B85042"],
.nma-kt [style*="184, 80, 66"],
.nma-kt [style*="b74f43"],
.nma-kt [style*="183, 79, 67"] {
    color: var(--c-ink) !important;
    border-color: var(--c-border) !important;
}

.nma-kt [style*="border-right: 3px solid"] {
    border-right: 1px solid var(--c-border) !important;
}

/* KIT summary warning (inline yellow) -> red-orange note */
.nma-kt div[style*="fff3cd"],
.nma-kt div[style*="255, 243, 205"] {
    background: var(--c-accent-soft) !important;
    border: none !important;
    border-radius: var(--radius-lg) !important;
}

.nma-kt div[style*="fff3cd"] span,
.nma-kt div[style*="255, 243, 205"] span {
    font-style: normal !important;
    color: var(--c-ink) !important;
    text-align: left !important;
}

/* ---------- header follow-ups ---------- */
/* outcome dropdowns: old fixed sizes in style.css (#sktdropdown-out, #stand-sktdropdown-out) */
.nma-kt #sktdropdown-out,
.nma-kt #stand-sktdropdown-out {
    display: block;
    width: 14em;
    height: auto;
    font-size: 0.95em;
}

/* report content lines up with the header cards */
.nma-kt #yoda_stand_start,
.nma-kt #yoda_stand_start + br {
    display: none;
}

.nma-kt #skt_sub_content [style*="padding-left: 5%"] {
    width: 100% !important;
    padding-left: 0 !important;
}

/* "Upload treatments instructions": no dashed inner frame (style.css .treat-instruct) */
.nma-kt .treat-instruct {
    margin: 0 !important;
    border: none !important;
}

/* Save (PICOS) when disabled: callback sets an inline grey; keep the button look, faded */
.nma-kt .sub-button.disabled-btn,
.nma-kt .sub-button:disabled {
    color: var(--c-primary-dark) !important;
    background: var(--c-surface) !important;
    border-color: #b9dedb !important;
    opacity: 0.5;
}

/* ---------- transitivity window (same controls as the Results "Transitivity assessment" box) ---------- */
.kt-trans-modal .modal-dialog {
    max-width: min(1200px, calc(100vw - 32px));
}

.kt-trans-modal .kt-trans-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.8em 2em;
    margin-bottom: 0.6em;
}

.kt-trans-modal .kt-trans-field {
    display: flex;
    align-items: center;
    gap: 0.7em;
    margin: 0;
}

.kt-trans-modal .kt-trans-label {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--c-ink);
}

.kt-trans-modal .kt-trans-select {
    width: 10em;
}

.kt-trans-modal .kt-trans-switch {
    display: flex;
    align-items: center;
    gap: 0.6em;
}

.kt-trans-modal .kt-trans-switch-label {
    font-weight: 500;
    color: var(--c-ink);
}

.kt-trans-modal .kt-trans-graph {
    height: 520px;
}

.kt-trans-modal .modal-footer {
    justify-content: space-between;
}

/* info window: heading of a group of columns (table "i") */
.nma-help-modal .kt-info-group-title {
    margin: 0.4em 0 0.6em;
    padding-bottom: 0.3em;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--c-primary-dark);
    border-bottom: 1px solid var(--c-border);
}

.nma-kt .network-toolbar { margin-right: 0; }

/* Overall Info: long lines (e.g. participants per outcome) wrap instead of being cut */
.nma-kt .skt_studyinfo .skt_span1 {
    white-space: normal !important;
    overflow-wrap: anywhere;
}

/* ---------- nested tables: "Show comparisons" button instead of the small arrow ---------- */
.nma-kt .kt-nested-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    width: 100%;
}

.nma-kt .kt-nested-name {
    font-weight: 700;
    color: var(--c-ink);
}

.nma-kt .kt-nested-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    height: 30px;
    padding: 0 0.75em;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--c-primary-dark);
    background: var(--c-surface);
    border: 1px solid #b9dedb;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nma-kt .kt-nested-toggle:hover,
.nma-kt .kt-nested-toggle:focus-visible {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
    outline: none;
}

.nma-kt .kt-nested-toggle.is-open {
    color: #fff;
    background: var(--c-primary);
    border-color: var(--c-primary);
}

.nma-kt .kt-nested-icon {
    font-size: 11px;
}

/* ---------- breathing room: nothing sits on the edge of its card ---------- */
.nma-kt .tab1,
.nma-kt .skt_studyinfo,
.nma-kt .tab3_col,
.nma-kt .row_skt > div[style*="dashed"] {
    padding: 0.9em 1.1em !important;
}

.nma-kt .tab3_col2 {
    padding: 0.9em 1.1em;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.nma-kt .tab1 .toast-body,
.nma-kt .skt_studyinfo .toast-body,
.nma-kt .tab3_col .toast-body {
    padding: 0;
}

/* ---------- PICOS: one box (the card), the text field has no frame of its own ---------- */
.nma-kt #picos_textarea,
.nma-kt #picos_textarea_advanced {
    display: block;
    width: 100% !important;
    min-height: 8em;
    margin-top: 0.5em;
    padding: 0.4em 0;
    text-align: left;
    background: transparent;
    border: none !important;
    border-radius: 0;
    box-shadow: none;
    resize: vertical;
}

.nma-kt #picos_textarea:focus,
.nma-kt #picos_textarea_advanced:focus {
    outline: none;
    background: var(--c-canvas);
}

.nma-kt #picos_row,
.nma-kt #picos_row_advanced {
    display: flex !important;
    align-items: center;
    gap: 0.3em;
    margin: 0;
}

.nma-kt #picos_row .sub-button,
.nma-kt #picos_row_advanced .sub-button {
    margin-left: auto;
}

/* PICOS card: the text field uses the full width of the card
   (style.css gives the card a fixed 198px grid column; Bootstrap limits toasts to 350px) */
.nma-kt .toast.tab1,
.nma-kt .toast.skt_studyinfo {
    max-width: none;
    width: 100% !important;
}

.nma-kt .tab1,
.nma-kt .bodytab1 {
    grid-template-columns: minmax(0, 1fr) !important;
}

.nma-kt .bodytab1 {
    width: 100% !important;
}

/* results tables: a card like the other boxes (was an antique-white strip) */
.nma-kt .skt_col2,
.nma-kt #col_nonexpert {
    padding: 0.9em 1.1em !important;
    background: var(--c-surface) !important;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* text next to the network graph: clear of the dividing line */
.nma-kt #toast_upload {
    padding-left: 1.2em;
}

.nma-kt #trigger_info,
.nma-kt #toast_upload ~ * {
    padding-left: 1.2em;
}

/* "Show comparisons" button: no inherited letter spacing from older button styles */
.nma-kt .kt-nested-toggle {
    letter-spacing: normal !important;
    text-transform: none !important;
}

/* PICOS text wraps inside the card */
.nma-kt #picos_textarea,
.nma-kt #picos_textarea_advanced {
    white-space: pre-wrap !important;
    overflow-wrap: anywhere;
}

/* "Select a node or edge to see more information." (next to the Detailed report graph) */
.nma-kt .kt-select-prompt {
    width: fit-content;
    max-width: 90%;
    margin: 1em auto;
    text-align: left;
}

/* transitivity window: white plot area, as in the Results box */
.kt-trans-modal .modal-body {
    background: var(--c-surface);
}

/* "First, upload a CSV ..." note next to the Detailed report graph */
.nma-kt #treat-instruct-span {
    margin-top: 1em;
    font-weight: 400;
}


/* ---------- editable fields are visibly editable ---------- */
/* table cells you can type in: framed, with a pencil (marked by fit_header_widths in tools/utils.py) */
.nma-kt .ag-cell.kt-editable-cell {
    background: #fbfefe !important;
    box-shadow: inset 0 0 0 1px #b9dedb;
    border-radius: 6px;
    padding-right: 26px !important;
    cursor: text;
}

.nma-kt .ag-cell.kt-editable-cell::after {
    content: "✎";
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--c-primary);
    opacity: 0.75;
    pointer-events: none;
}

.nma-kt .ag-cell.kt-editable-cell:hover {
    background: var(--c-primary-soft) !important;
    box-shadow: inset 0 0 0 1px var(--c-primary);
}

.nma-kt .ag-cell.kt-editable-cell.ag-cell-inline-editing::after {
    content: none;
}

/* header of an editable column: a pencil after the name */
.nma-kt .ag-header-cell.kt-editable-header .ag-header-cell-comp-wrapper::after {
    content: "✎";
    margin-left: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--c-primary);
}

/* PICOS text: a visible field inside the card (one card, the field shows it can be typed in) */
.nma-kt #picos_textarea,
.nma-kt #picos_textarea_advanced {
    padding: 0.55em 0.75em !important;
    background: #fbfefe !important;
    border: 1px solid #b9dedb !important;
    border-radius: var(--radius-md) !important;
    cursor: text;
}

.nma-kt #picos_textarea:hover,
.nma-kt #picos_textarea_advanced:hover {
    border-color: var(--c-primary) !important;
}

.nma-kt #picos_textarea:focus,
.nma-kt #picos_textarea_advanced:focus {
    background: #fff !important;
    border-color: var(--c-primary) !important;
    box-shadow: 0 0 0 3px rgba(31, 138, 138, 0.15);
}

/* other inputs on the page (e.g. smallest worthwhile difference, chatbot question) */
.nma-kt input[type="text"],
.nma-kt input[type="number"] {
    border: 1px solid #b9dedb;
    border-radius: var(--radius-md);
    background: #fbfefe;
}

.nma-kt input[type="text"]:focus,
.nma-kt input[type="number"]:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31, 138, 138, 0.15);
}

/* ---------- tables (AG Grid): light lines and the app colours ---------- */
.nma-kt .ag-theme-alpine {
    --ag-header-column-separator-color: var(--c-border);
    --ag-header-column-resize-handle-color: var(--c-border);
    --ag-row-border-color: #e4eaef;
    --ag-border-color: var(--c-border);
    --ag-selected-row-background-color: #eef6f6;
    --ag-row-hover-color: #f6fafb;
    --ag-header-background-color: var(--c-canvas);
}

/* cell borders set inline ("solid 0.8px", black or red) -> light lines */
.nma-kt .ag-cell {
    border-color: #e4eaef !important;
}

/* significant results (inline red) -> the app's red */
.nma-kt .ag-cell[style*="color: red"] {
    color: #c94a3c !important;
}

/* nested table: an inset panel under its row */
.nma-kt .ag-details-row {
    padding: 0.9em 1.2em 1.2em 1.6em !important;
    background: #f4f8f9 !important;
    border-left: 4px solid var(--c-primary);
}

.nma-kt .ag-details-row .ag-root-wrapper {
    border: 1px solid var(--c-border) !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.nma-kt .ag-details-row .ag-header {
    background: #eef6f6 !important;
}

.nma-kt .ag-details-row .ag-header-cell-text,
.nma-kt .ag-details-row .ag-header-cell {
    color: var(--c-primary-dark) !important;
}

/* the opened row: light teal instead of blue */
.nma-kt .ag-row.ag-row-group-expanded,
.nma-kt .ag-row-selected {
    background: #eef6f6 !important;
}

/* ---------- loading message of the Detailed report table ---------- */
.nma-kt .ag-overlay-loading-wrapper {
    min-height: 140px;
    background: rgba(255, 255, 255, 0.85);
}

.nma-kt .kt-table-loading {
    display: flex;
    align-items: center;
    gap: 0.9em;
    padding: 0.9em 1.3em;
    font-size: 15px;
    line-height: 1.45;
    text-align: left;
    color: var(--c-ink);
    background: var(--c-accent-soft);
    border: 1.5px solid var(--c-accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.nma-kt .kt-table-spinner {
    flex: none;
    width: 26px;
    height: 26px;
    border: 3px solid rgba(31, 138, 138, 0.2);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: kt-spin 0.8s linear infinite;
}

@keyframes kt-spin {
    to { transform: rotate(360deg); }
}

/* AG Grid colours: style.css sets brown/orange header colours with !important */
.nma-kt .ag-theme-alpine,
.nma-kt .ag-theme-alpine .ag-details-grid .ag-header {
    --ag-header-foreground-color: var(--c-ink) !important;
    --ag-header-background-color: var(--c-canvas) !important;
    --ag-header-column-resize-handle-color: var(--c-border) !important;
    --ag-header-cell-hover-background-color: #eef6f6 !important;
}

.nma-kt .ag-theme-alpine .ag-details-row .ag-header {
    --ag-header-background-color: #eef6f6 !important;
}

/* ---------- report switch: a choice between two reports, not on/off -> teal on both sides ---------- */
.nma-kt .kt-switch .daq-toggleswitch--light__background {
    background: #cfe8e6 !important;
    border: 1px solid #9fd0cc !important;
}

.nma-kt .kt-switch .daq-toggleswitch--light__button {
    background: var(--c-primary) !important;
    border-color: #fff !important;
    box-shadow: 0 1px 3px rgba(29, 43, 58, 0.25);
}

.nma-kt .kt-switch [class*="daq-toggleswitch--light__indicator"] {
    display: none !important;
}

/* ---------- typing in editable fields: clear frame and a visible cursor ---------- */
.nma-kt .ag-cell.ag-cell-inline-editing {
    padding: 0 !important;
    background: #fff !important;
    box-shadow: inset 0 0 0 2px var(--c-primary) !important;
}

.nma-kt .ag-cell.ag-cell-inline-editing::after {
    content: none !important;
}

.nma-kt .ag-cell-inline-editing input,
.nma-kt .ag-cell-inline-editing textarea,
.nma-kt .ag-cell-editor input {
    width: 100% !important;
    height: 100% !important;
    padding: 0 0.7em !important;
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--c-ink) !important;
    background: #fff !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    caret-color: var(--c-primary-dark);
}

.nma-kt #picos_textarea,
.nma-kt #picos_textarea_advanced,
.nma-kt input[type="text"],
.nma-kt input[type="number"] {
    caret-color: var(--c-primary-dark);
}

/* PICOS: "✎ Click to type" next to the title */
.nma-kt .kt-edit-hint {
    font-size: 0.78em;
    font-weight: 600;
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    padding: 0.15em 0.6em;
    border-radius: 999px;
    white-space: nowrap;
}

/* uploaded description of the interventions: green file name (as the other uploads) + Download */
.nma-kt .kt-upload-file-row {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3em 0.7em;
    margin: 0.5em 0 0 0.6em;
}

.nma-kt .kt-upload-filename {
    margin: 0 !important;
    font-size: 0.85em !important;
}

.nma-kt .kt-file-download {
    align-items: center;
    height: 26px;
    padding: 0 0.7em;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--c-primary-dark);
    background: var(--c-surface);
    border: 1px solid #b9dedb;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.nma-kt .kt-file-download::before {
    content: "↓";
    margin-right: 0.35em;
}

.nma-kt .kt-file-download:hover {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
}

/* KIT summary: the PICOS / Overall Info / effect modifiers row lines up with the note above and the
   network box below (both 5% in from each side) */
.nma-kt #skt_nonexpert_page .row_skt:has(#picos_textarea) {
    width: 90% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.nma-kt #skt_nonexpert_page .row_skt:has(#picos_textarea) > * {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.nma-kt #skt_nonexpert_page .row_skt:has(#picos_textarea) {
    display: flex !important;
    gap: 0 !important;
}

/* the three cards fill the row (PICOS a bit wider); hidden window wrappers take no space */
.nma-kt #skt_nonexpert_page .row_skt:has(#picos_textarea) > .col {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
}

.nma-kt #skt_nonexpert_page .row_skt:has(#picos_textarea) > .col:first-child {
    flex-grow: 1.5 !important;
}

.nma-kt #skt_nonexpert_page .row_skt:has(#picos_textarea) > .col + .col {
    margin-left: 0.9em !important;
}

/* second "i" above the Detailed report table (nested tables) */
.nma-kt .kt-table-info-extra {
    margin-left: 1.2em;
    padding-left: 1.2em;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--c-ink-muted);
    border-left: 1px solid var(--c-border);
}

/* transitivity window: white body */
.nma-modal.kt-trans-modal .modal-body {
    background: #fff !important;
}

/* Options box: scale of the forest plots */
.nma-kt .kt-scale-title {
    display: block;
    margin-top: 0.8em;
}

.nma-kt .kt-scale-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4em 0.8em;
    margin-top: 0.3em;
}

.nma-kt .kt-scale-row label {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    margin: 0;
}

.nma-kt .kt-scale-label {
    font-size: 0.85em;
    color: var(--c-ink-muted);
}

.nma-kt .kt-scale-input {
    width: 5.5em;
    height: 2.1em;
    padding: 0.2em 0.5em;
}

/* Options box: label with its "i" */
.nma-kt .kt-option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1em;
}

.nma-kt .kt-option-label .kt-info-button {
    width: 20px;
    height: 20px;
    min-width: 20px;
    font-size: 13px;
}

/* ---------- Detailed report: Overall Info + effect modifiers share the row; Options card below ---------- */
.nma-kt .row_skt:has(#kt_numstudies2) > .col {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
}

.nma-kt .row_skt:has(#kt_numstudies2) > .col:first-child {
    flex-grow: 1.6 !important;
}

.nma-kt .kt-options-row {
    display: block !important;
}

.nma-kt .kt-options-card {
    width: 100%;
    padding: 0.9em 1.2em 1em;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.nma-kt .kt-options-title {
    margin-bottom: 0.7em;
    font-size: 1.02em;
    font-weight: 700;
    color: var(--c-ink);
}

.nma-kt .kt-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9em 2.4em;
    align-items: flex-start;
}

.nma-kt .kt-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4em;
}

.nma-kt .kt-option .kt-option-label {
    justify-content: flex-start;
}

.nma-kt .kt-option-head {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--c-ink-muted);
}

.nma-kt .kt-option .kt-scale-row {
    justify-content: flex-start;
    margin: 0;
}

.nma-kt .kt-option-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em 1.2em;
    font-size: 0.92em;
    color: var(--c-ink);
}

.nma-kt .kt-option-checks label {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    margin: 0;
    cursor: pointer;
}

.nma-kt .kt-option-checks input[type="checkbox"] {
    accent-color: var(--c-primary);
    width: 16px;
    height: 16px;
}

/* Detailed report: every row spans the full width, like the header cards above */
.nma-kt #sky_expert_page .row_skt,
.nma-kt #sky_expert_page .skt_rowtable {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 0.9em !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.nma-kt #sky_expert_page .row_skt > .col,
.nma-kt #sky_expert_page .skt_rowtable > .col {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.nma-kt #sky_expert_page .row_skt:has(#picos_textarea_advanced) > .col:first-child {
    flex: 0 0 22% !important;
    width: auto !important;
    max-width: none !important;
}

.nma-kt #sky_expert_page .row_skt:has(#picos_textarea_advanced) > .col:nth-child(2) {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
}

.nma-kt #sky_expert_page .skt_rowtable > .col {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
}

/* "Show comparisons": solid teal, as the app's main buttons (e.g. Graph Options); "Hide comparisons": outlined */
.nma-kt .kt-nested-toggle {
    color: #fff;
    background: var(--c-primary);
    border-color: var(--c-primary);
}

.nma-kt .kt-nested-toggle:hover,
.nma-kt .kt-nested-toggle:focus-visible {
    color: #fff;
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
}

.nma-kt .kt-nested-toggle.is-open {
    color: var(--c-primary-dark);
    background: var(--c-surface);
    border-color: #b9dedb;
}

.nma-kt .kt-nested-toggle.is-open:hover {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
}

/* Detailed report table card: keep its inner padding (the full-width row rules above remove the
   padding of row columns) */
.nma-kt #sky_expert_page .skt_rowtable > .col.skt_col2 {
    padding: 0.9em 1.1em 1.1em !important;
}

/* hidden window holders (modals) inside the rows take no place and no gap */
.nma-kt #sky_expert_page .row_skt > :not(.col):not(.kt-options-card),
.nma-kt #skt_nonexpert_page .row_skt > :not(.col):not(.kt-options-card) {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
}

/* ---------- Overall info / Potential effect modifiers cards: same heading, tidy rows, equal height ---------- */
.nma-kt .row_skt:has(.skt_studyinfo) {
    align-items: stretch !important;
}

.nma-kt .row_skt:has(.skt_studyinfo) > .col {
    display: flex !important;
}

.nma-kt .row_skt:has(.skt_studyinfo) > .col > .toast {
    flex: 1 1 auto;
    height: auto !important;
}

.nma-kt .skt_studyinfo,
.nma-kt .skt_studyinfo .toast-body {
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start;
    text-align: left !important;
    gap: 0 !important;
}

.nma-kt .skt_studyinfo .toast-body {
    flex: 1 1 auto;
    padding: 0 !important;
}

.nma-kt .skt_studyinfo .study_design,
.nma-kt .kt-options-title .study_design {
    align-self: flex-start;
    margin: 0 0 0.6em !important;
}

.nma-kt #kt_modifiers_info,
.nma-kt #kt_modifiers_info2 {
    flex: none;
    width: 100%;
    padding: 0;
}

.nma-kt .kt-stat {
    display: flex !important;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    padding: 0.38em 0;
    font-size: 0.92em;
    line-height: 1.35;
    border-bottom: 1px solid #edf1f4;
}

.nma-kt .kt-stat:last-child {
    border-bottom: none;
}

.nma-kt .kt-stat-label {
    color: var(--c-ink-muted);
}

.nma-kt .kt-stat-value {
    font-weight: 700;
    color: var(--c-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* the card's button sits at the bottom */
.nma-kt .skt_studyinfo #trans_button {
    align-self: flex-start;
    margin-top: auto !important;
    margin-bottom: 0;
}

.nma-kt .skt_studyinfo .toast-body > #trans_button,
.nma-kt .skt_studyinfo > #trans_button {
    margin-top: 0.8em;
}

.nma-kt .kt-options-title {
    margin-bottom: 0.5em;
}

/* same size for every row of the two cards; a light line between rows */
.nma-kt .skt_studyinfo .kt-stat,
.nma-kt .skt_studyinfo .skt_span1 .kt-stat {
    font-size: 14.5px !important;
    border-bottom: 1px solid #edf1f4 !important;
}

/* same size for every row of the two cards; a light line between rows */
.nma-kt .skt_studyinfo .kt-stat,
.nma-kt .skt_studyinfo .skt_span1 .kt-stat {
    font-size: 14.5px !important;
    border-bottom: 1px solid #edf1f4 !important;
}

/* KIT summary warning: as wide as the boxes below it */
.nma-kt .kt-summary-warning {
    width: 90%;
    margin: 0 auto 0.9em !important;
}

/* Detailed report network graph card: keep its inner padding (the full-width row rules remove the
   padding of row columns) */
.nma-kt #sky_expert_page .row_skt > .col.tab3_col {
    padding: 0.9em 1.1em !important;
}

/* =====================================================================
   NMA-KIT tables (page and windows): one font, quiet colours
   ===================================================================== */
:is(.nma-kt, .kt-window) .ag-theme-alpine,
:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-details-grid .ag-header {
    --ag-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    --ag-font-size: 14px !important;
    --ag-foreground-color: #1d2b3a;
    --ag-header-foreground-color: #3d4f60 !important;
    --ag-header-background-color: #f4f7f9 !important;
    --ag-header-column-resize-handle-color: #d5dee6 !important;
    --ag-header-cell-hover-background-color: #eef6f6 !important;
    --ag-odd-row-background-color: #fbfcfd;
    --ag-row-border-color: #e8edf1;
    --ag-border-color: #dde5ec;
    --ag-row-hover-color: #f2f8f8;
    --ag-selected-row-background-color: #eef6f6;
    --ag-cell-horizontal-padding: 14px;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-cell {
    font-size: 14px;
    color: #1d2b3a;
    font-variant-numeric: tabular-nums;
}

:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-header-cell,
:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-header-group-cell {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #3d4f60 !important;
}

:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-header-cell-text,
:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-header-group-text {
    font-weight: 600 !important;
    color: #3d4f60 !important;
}

:is(.nma-kt, .kt-window) .ag-theme-alpine .ag-header {
    border-bottom: 1px solid #dde5ec !important;
}

/* outcome group headers of the KIT summary (PASI90, SAE ...) */
.nma-kt #grid_treat_compare .ag-header-group-cell {
    font-size: 13.5px;
    color: var(--c-primary-dark) !important;
}

.nma-kt #grid_treat_compare .ag-header-group-text {
    color: var(--c-primary-dark) !important;
    font-weight: 700 !important;
}

/* confidence ratings / risk of bias (coloured inline): soft cells with strong text */
:is(.nma-kt, .kt-window) .ag-cell[style*="90, 164, 105"] {
    background: #dff2e7 !important;
    color: #1e6b45 !important;
    font-weight: 600;
}

:is(.nma-kt, .kt-window) .ag-cell[style*="248, 212, 157"] {
    background: #fcefd4 !important;
    color: #8a5a00 !important;
    font-weight: 600;
}

:is(.nma-kt, .kt-window) .ag-cell[style*="184, 80, 66"],
:is(.nma-kt, .kt-window) .ag-cell[style*="B85042"],
:is(.nma-kt, .kt-window) .ag-cell[style*="b85042"] {
    background: #fbe2dc !important;
    color: #a3352a !important;
    font-weight: 600;
}

/* intervention / comparator names */
.nma-kt #grid_treat_compare .ag-cell[col-id="Treatment"],
.nma-kt #grid_treat_compare .ag-cell[col-id="Reference"] {
    font-weight: 700;
    color: #1d2b3a;
}

/* "no rows" message */
:is(.nma-kt, .kt-window) .ag-overlay-no-rows-center {
    font-size: 14px;
    color: var(--c-ink-muted);
}

/* ---------- NMA-KIT windows: same look as the app's other windows ---------- */
.nma-modal.kt-window .modal-header,
.nma-modal.kt-window .skt_info_head_simple,
.nma-modal.kt-window .skt_info_head,
.nma-modal.kt-window .forest_head {
    background: var(--c-surface) !important;
    color: var(--c-ink) !important;
    border-bottom: 1px solid var(--c-border) !important;
    font-family: var(--font-ui) !important;
    font-size: 1.15em !important;
    font-weight: 700 !important;
    letter-spacing: normal !important;
    justify-content: flex-start !important;
}

.nma-modal.kt-window .modal-header p {
    margin: 0;
    font: inherit;
    color: inherit;
}

.nma-modal.kt-window .modal-content {
    border: none !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
    font-family: var(--font-ui);
}

.nma-modal.kt-window .modal-body {
    background: #fff !important;
    color: var(--c-ink);
}

.nma-modal.kt-window .modal-footer,
.nma-modal.kt-window .skt_info_close_simple,
.nma-modal.kt-window .skt_info_close,
.nma-modal.kt-window .forest_close {
    background: var(--c-canvas) !important;
    border-top: 1px solid var(--c-border) !important;
}

.nma-modal.kt-window .modal-footer .btn {
    height: 34px;
    padding: 0 16px;
    font-family: var(--font-ui) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: normal !important;
    color: #fff !important;
    background: var(--c-primary) !important;
    border: 1px solid var(--c-primary) !important;
    border-radius: var(--radius-md) !important;
}

.nma-modal.kt-window .modal-footer .btn:hover {
    background: var(--c-primary-dark) !important;
}

/* texts inside the comparison window: the app's colours instead of red / green */
.nma-modal.kt-window [style*="color: red"],
.nma-modal.kt-window [style*="color: green"] {
    color: var(--c-ink) !important;
}

.nma-modal.kt-window hr,
.nma-modal.kt-window [style*="border-bottom: 2px solid green"],
.nma-modal.kt-window [style*="solid green"] {
    border-color: var(--c-border) !important;
}

/* comparison window (KIT summary): labels in the app's colours, table header like the other tables */
.nma-modal.kt-window .abvalue_simple,
.nma-modal.kt-window .abvalue_simple p {
    color: var(--c-ink) !important;
    font-weight: 700;
}

.nma-modal.kt-window .abvalue_range,
.nma-modal.kt-window .abvalue_range p {
    color: var(--c-ink-muted) !important;
    font-size: 0.9em;
}

.nma-modal.kt-window #modal_treat_compare {
    --ag-header-foreground-color: #3d4f60 !important;
    --ag-header-background-color: #f4f7f9 !important;
    --ag-font-size: 14px !important;
}

.nma-modal.kt-window #simple_abvalue {
    height: 2.2em;
    padding: 0.2em 0.6em;
    border: 1px solid #b9dedb;
    border-radius: var(--radius-md);
    background: #fbfefe;
    caret-color: var(--c-primary-dark);
}

/* note under the global inconsistency row */
.nma-kt .kt-stat-note {
    display: block;
    padding: 0.15em 0 0.4em;
    font-size: 12.5px;
    color: var(--c-ink-muted);
    border-bottom: 1px solid #edf1f4;
}

.nma-kt #kt_global_incons .kt-stat,
.nma-kt #kt_global_incons2 .kt-stat {
    border-bottom: none !important;
    padding-bottom: 0.1em;
}

/* ---------- tooltip of a confidence rating (hover a cell) ---------- */
.kt-tip {
    min-width: 260px;
    max-width: 320px;
    padding: 0.8em 0.95em 0.7em;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: #1d2b3a;
    background: #fff;
    border: 1px solid #dde5ec;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(29, 43, 58, 0.16);
}

.kt-tip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #edf1f4;
}

.kt-tip-title {
    font-weight: 700;
}

.kt-tip-rating {
    padding: 0.15em 0.65em;
    font-weight: 700;
    border-radius: 999px;
    background: #eef2f6;
    color: #3d4f60;
}

.kt-tip-rating-high { background: #dff2e7; color: #1e6b45; }
.kt-tip-rating-moderate { background: #fcefd4; color: #8a5a00; }
.kt-tip-rating-low { background: #fbe2dc; color: #a3352a; }
.kt-tip-rating-very-low { background: #c4473a; color: #ffffff; }

.kt-tip-sub {
    margin: 0.55em 0 0.3em;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5b6b7b;
}

.kt-tip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8em;
    padding: 0.22em 0;
}

.kt-tip-label {
    color: #3d4f60;
}

.kt-tip-level {
    font-weight: 600;
    white-space: nowrap;
}

.kt-tip-level-none { color: #1e6b45; }
.kt-tip-level-some { color: #8a5a00; }
.kt-tip-level-major { color: #a3352a; }
.kt-tip-level-unknown { color: #5b6b7b; }

/* AG Grid wraps custom tooltips in its own box: no second frame */
.ag-theme-alpine .ag-tooltip-custom,
.ag-tooltip-custom {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* rows like the Overall info card, also inside the NMA-KIT windows */
.kt-window .kt-stat {
    display: flex !important;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    padding: 0.42em 0;
    font-size: 14.5px;
    border-bottom: 1px solid #edf1f4;
}

.kt-window .kt-stat-label { color: var(--c-ink-muted); }

.kt-window .kt-stat-value {
    font-weight: 700;
    color: var(--c-ink);
    font-variant-numeric: tabular-nums;
}

/* "Comparison details" window (click an intervention in a nested table) */
.kt-window .skt_info_body {
    display: flex !important;
    flex-direction: column;
    gap: 0 !important;
    padding: 1em 1.3em 1.2em !important;
    text-align: left !important;
}

.kt-window .skt_span_info {
    display: block !important;
    margin: 0 !important;
    font-size: inherit !important;
    color: inherit !important;
    text-align: left !important;
}

.kt-window .kt-detail-title {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--c-ink);
}

.kt-window .kt-detail-sub,
.kt-window .kt-detail-section {
    margin: 0.1em 0 0.7em;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--c-ink-muted);
}

.kt-window .kt-detail-section {
    margin-top: 1em;
    color: var(--c-primary-dark);
}

.kt-window .kt-detail-note {
    margin-top: 0.8em;
    padding: 0.7em 0.9em;
    font-size: 14px;
    line-height: 1.45;
    color: var(--c-ink);
    background: var(--c-accent-soft);
    border-radius: var(--radius-md);
}

/* pairwise forest plot window (click a direct effect): wide enough for the plot and its columns */
.nma-modal.kt-window:has(#forest-fig-pairwise) .modal-dialog {
    max-width: min(1100px, calc(100vw - 32px));
}

.nma-modal.kt-window #forest-fig-pairwise {
    max-width: none !important;
    width: 100% !important;
}

/* pairwise forest plot window: old fixed sizes (style.css .forest_*) no longer apply */
.nma-modal.kt-window .forest_body {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0.6em 1.2em 1em !important;
    text-align: left !important;
}

.nma-modal.kt-window .forest_body [style*="height: 450px"],
.nma-modal.kt-window .forest_body [style*="height:450px"] {
    height: auto !important;
}

.nma-modal.kt-window .forest_close {
    display: flex !important;
    justify-content: flex-end !important;
    width: auto !important;
}

.nma-modal.kt-window .forest_head {
    display: flex !important;
    height: auto !important;
    padding: 1rem 1.3rem !important;
}

/* pairwise forest plot window: the old fixed size / background / offset of #modal_forest (style.css) */
#modal_forest {
    width: auto !important;
    height: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    background: transparent !important;
    display: block !important;
}

.nma-modal.kt-window .modal-dialog.modal-xl {
    max-width: min(1100px, calc(100vw - 32px)) !important;
}

/* ---------- cells that open more information: a visible mark ---------- */
/* click: opens a window (KIT summary effect; nested intervention name and direct effect) */
.nma-kt #grid_treat_compare .ag-cell[col-id$="_label"],
.nma-kt .ag-details-row .ag-cell[col-id="Treatment"],
.nma-kt .ag-details-row .ag-cell[col-id="direct"]:not(:empty) {
    cursor: pointer;  /* (no position change: AG Grid positions the cells itself) */
}

.nma-kt #grid_treat_compare .ag-cell[col-id$="_label"]::after,
.nma-kt .ag-details-row .ag-cell[col-id="Treatment"]::after,
.nma-kt .ag-details-row .ag-cell[col-id="direct"]:not(:empty)::after {
    content: "↗";
    position: absolute;
    top: 6px;
    right: 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: var(--c-primary);
    opacity: 0.75;
    pointer-events: none;
}

.nma-kt #grid_treat_compare .ag-cell[col-id$="_label"]:hover,
.nma-kt .ag-details-row .ag-cell[col-id="Treatment"]:hover,
.nma-kt .ag-details-row .ag-cell[col-id="direct"]:not(:empty):hover {
    background: #eaf5f4 !important;
    box-shadow: inset 0 0 0 1px #b9dedb;
}

.nma-kt #grid_treat_compare .ag-cell[col-id$="_label"]:hover::after,
.nma-kt .ag-details-row .ag-cell[col-id="Treatment"]:hover::after,
.nma-kt .ag-details-row .ag-cell[col-id="direct"]:not(:empty):hover::after {
    opacity: 1;
}

/* hover: shows the CINeMA domains of a confidence rating */
.nma-kt .ag-cell[col-id^="Certainty"]:not(:empty) {
    cursor: help;
}

.nma-kt .ag-cell[col-id^="Certainty"]:not(:empty)::after {
    content: "i";
    position: absolute;
    top: 6px;
    right: 7px;
    display: grid;
    place-items: center;
    width: 14px;
    height: 14px;
    font-family: Georgia, serif;
    font-size: 10px;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.55;
    pointer-events: none;
}

.nma-kt .ag-cell[col-id^="Certainty"]:not(:empty):hover::after {
    opacity: 0.9;
}

/* legend next to the table titles */
.nma-kt .kt-legend {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3em 1.1em;
    margin-left: auto;
    font-size: 12.5px;
    color: var(--c-ink-muted);
}

.nma-kt .kt-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

.nma-kt .kt-mark {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 4px;
}

.nma-kt .kt-mark-click {
    color: var(--c-primary);
    background: #eaf5f4;
    border: 1px solid #b9dedb;
}

.nma-kt .kt-mark-hover {
    font-family: Georgia, serif;
    font-style: italic;
    color: #fff;
    background: #8a99a8;
    border-radius: 50%;
}

.nma-kt .kt-table-info {
    flex-wrap: wrap;
}

/* global inconsistency in the Overall info card: in bold */
.nma-kt #kt_global_incons .kt-stat-label,
.nma-kt #kt_global_incons2 .kt-stat-label,
.nma-kt #kt_global_incons .kt-stat-note,
.nma-kt #kt_global_incons2 .kt-stat-note {
    font-weight: 700;
    color: var(--c-ink);
}

.nma-kt .kt-forest-scale {
    width: 6.5em;
}

/* confidence cells: the hover mark more visible (solid, bigger, white ring) */
.nma-kt .ag-cell[col-id^="Certainty"]:not(:empty)::after {
    top: 50% !important;
    right: 8px !important;
    transform: translateY(-50%);
    width: 18px !important;
    height: 18px !important;
    font-size: 12px !important;
    opacity: 1 !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.nma-kt .ag-cell[col-id^="Certainty"]:not(:empty):hover::after {
    transform: translateY(-50%) scale(1.12);
}

/* hover mark background: the dark colour of each rating (white "i" on it) */
.nma-kt .ag-cell[col-id^="Certainty"]:not(:empty)::after {
    color: #fff !important;
    background: #5b6b7b !important;
}

.nma-kt .ag-cell[col-id^="Certainty"][style*="90, 164, 105"]:not(:empty)::after {
    background: #1e6b45 !important;
}

.nma-kt .ag-cell[col-id^="Certainty"][style*="248, 212, 157"]:not(:empty)::after {
    background: #b07a12 !important;
}

.nma-kt .ag-cell[col-id^="Certainty"][style*="184, 80, 66"]:not(:empty)::after,
.nma-kt .ag-cell[col-id^="Certainty"][style*="B85042"]:not(:empty)::after,
.nma-kt .ag-cell[col-id^="Certainty"][style*="b85042"]:not(:empty)::after {
    background: #a3352a !important;
}

/* legend for the click / hover marks: a visible framed hint next to the table title */
.nma-kt .kt-legend {
    gap: 0.5em 1.4em !important;
    padding: 0.5em 0.9em;
    font-size: 14px !important;
    font-weight: 500;
    color: var(--c-ink) !important;
    background: #f4f8f9;
    border: 1px solid #d5e6e5;
    border-radius: var(--radius-md);
}

.nma-kt .kt-legend-item {
    gap: 0.5em !important;
}

.nma-kt .kt-legend-item > span:last-child {
    line-height: 1.3;
}

.nma-kt .kt-mark {
    width: 22px !important;
    height: 22px !important;
    font-size: 13px !important;
}

.nma-kt .kt-mark-click {
    color: #fff !important;
    background: var(--c-primary) !important;
    border-color: var(--c-primary) !important;
}

.nma-kt .kt-mark-hover {
    background: #1e6b45 !important;
    box-shadow: 0 0 0 2px #fff;
}

/* column options (⋮) and column resize lines: clearly visible */
:is(.nma-kt, .kt-window) .ag-header-cell-menu-button,
:is(.nma-kt, .kt-window) .ag-header-icon.ag-header-cell-menu-button {
    display: inline-grid !important;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--c-primary-dark) !important;
    background: #e3f0ef;
    border-radius: 6px;
    opacity: 1 !important;
    cursor: pointer;
}

:is(.nma-kt, .kt-window) .ag-header-cell-menu-button:hover {
    color: #fff !important;
    background: var(--c-primary);
}

:is(.nma-kt, .kt-window) .ag-theme-alpine {
    --ag-header-column-resize-handle-display: block !important;
    --ag-header-column-resize-handle-height: 55% !important;
    --ag-header-column-resize-handle-width: 2px !important;
    --ag-header-column-resize-handle-color: #8fa3b3 !important;
}

/* the resize handle: teal while hovering (position / size: AG Grid's own) */
:is(.nma-kt, .kt-window) .ag-header-cell-resize {
    cursor: col-resize;
}

:is(.nma-kt, .kt-window) .ag-header-cell-resize:hover::after {
    background-color: var(--c-primary) !important;
    width: 3px !important;
    height: 70% !important;
}


/* ---------- intervention files: full names + description (Detailed report, right of the graph) ---------- */
.nma-kt .kt-files-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    margin-bottom: 0.7em;
}

.nma-kt .kt-files-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--c-ink);
}

.nma-kt .kt-file-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.9em;
}

.nma-kt .kt-file-block .kt-upload-file-row {
    margin: 0.45em 0 0;
}

.nma-kt .kt-file-block .kt-upload-file-row:empty,
.nma-kt .kt-file-block .kt-upload-file-row:not(:has(.kt-upload-filename:not(:empty), .kt-upload-error:not(:empty))) {
    display: none;
}

/* a full-names file that could not be read */
.nma-kt .kt-upload-error {
    max-width: 30em;
    font-size: 0.85em;
    font-weight: 600;
    color: #b8452d;
}

/* upload button with its "i" next to it */
.nma-kt .kt-file-upload-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

/* KIT summary: full names upload and the ranking button under the graph, side by side */
.nma-kt .kt-graph-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5em 1em;
    margin-top: 0.3em;
}

.nma-kt .kt-graph-actions .kt-file-block {
    align-items: flex-start;
    margin-bottom: 0;
}

/* ---------- legend of the intervention names under the network graphs ---------- */
.nma-kt .kt-names-legend {
    margin: 0.6em 0 0.7em;
    padding: 0.6em 0.85em;
    font-size: 0.82em;
    color: var(--c-ink);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.nma-kt .kt-names-legend-title {
    margin-bottom: 0.35em;
    font-weight: 700;
    color: var(--c-ink-muted);
}

.nma-kt .kt-names-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.25em 1.2em;
}

.nma-kt .kt-names-item {
    display: flex;
    gap: 0.5em;
    line-height: 1.35;
}

.nma-kt .kt-names-abbr {
    flex: none;
    min-width: 4.5em;
    font-weight: 700;
    color: var(--c-primary-dark);
}

.nma-kt .kt-names-full {
    color: var(--c-ink);
}

/* intervention names in the tables: wrap between words, never inside a name */
.nma-kt .ag-cell[col-id="Treatment"],
.nma-kt .ag-cell[col-id="Reference"],
.nma-kt .ag-cell[col-id="Treatment"] *,
.nma-kt .ag-cell[col-id="Reference"] * {
    word-break: normal !important;
    overflow-wrap: normal !important;
}

/* Detailed report, right of the network graph: intervention files at the top, the names legend under them,
   then the information on the selected node / edge */
.nma-kt .kt-files-col {
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.6em;
}

.nma-kt .kt-files-col #toast_upload {
    width: 100%;
    max-width: none;
    margin: 0;
}

.nma-kt .kt-files-col .kt-names-legend {
    margin: 0;
}

/* Detailed report table: "Show comparisons" under the intervention name */
.nma-kt .kt-nested-cell {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.3em;
    padding: 0.35em 0;
    line-height: 1.25;
}

.nma-kt .kt-nested-name {
    white-space: normal;
}

/* names legend next to the Detailed report graph: clear of the dividing line, normal inner padding */
.nma-kt .kt-files-col .kt-names-legend {
    margin-left: 1.2em !important;
    padding: 0.6em 0.85em !important;
}

/* column menu: AG Grid's own button (≡ icon) drawn as ⋮, like the app's headers (HeaderWithIcon);
   both open the same column menu */
:is(.nma-kt, .kt-window) .ag-header-cell-menu-button .ag-icon {
    display: none !important;
}

:is(.nma-kt, .kt-window) .ag-header-cell-menu-button:has(.ag-icon)::before {
    content: "⋮";
    line-height: 1;
}

/* ---------- KIT summary, right of the network graph ---------- */
/* intervention files, ranking and names legend at the top; Ask Dr.Bot below, its question box at the bottom */
.nma-kt .kt-bot-col {
    display: flex !important;
    flex-direction: column;
    gap: 1em;
    padding-left: 1.2em !important;
}

.nma-kt .kt-summary-files .kt-graph-actions {
    margin-top: 0;
}

.nma-kt .kt-summary-files .kt-names-legend {
    margin: 0.7em 0 0;
}

.nma-kt .kt-bot-section {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 340px;
    padding-top: 0.9em;
    border-top: 1px solid var(--c-border);
}

.nma-kt .kt-bot-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    margin-bottom: 0.4em;
}

/* the chatbot (tools/functions_chatbot.py): fill the rest of the box */
.nma-kt .kt-bot-section > div:last-child {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    height: auto !important;
}

.nma-kt .kt-bot-section > div:last-child > .container-fluid,
.nma-kt .kt-bot-section > div:last-child .row,
.nma-kt .kt-bot-section > div:last-child .col-10,
.nma-kt .kt-bot-section > div:last-child .card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: auto !important;
}

.nma-kt .kt-bot-section > div:last-child .row {
    flex-direction: row;
}

.nma-kt .kt-bot-section .card-body {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column;
    height: auto !important;
    padding-bottom: 0;
}

/* conversation fills the space; the question box sits at the bottom */
.nma-kt .kt-bot-section .card-body > div:first-child {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 140px;
}

.nma-kt .kt-bot-section .card-body > div:nth-child(2) {
    margin: auto auto 0.4em !important;
}

/* KIT summary: "Click to see the ranking results" under the network graph */
.nma-kt .kt-ranking-button {
    margin-top: 0.7em !important;
}

/* ---------- compact intervention files and names legend (both reports) ---------- */
/* upload buttons: smaller than the other buttons, both the same size */
.nma-kt .kt-file-upload,
.nma-kt #treat-instruction-upload {
    height: 28px !important;
    padding: 0 10px !important;
    font-size: 12.5px !important;
}

.nma-kt .kt-file-upload a,
.nma-kt #treat-instruction-upload a,
.nma-kt #treat-instruction-upload .treat-instruct {
    font-size: 12.5px !important;
}

.nma-kt .kt-upload-filename {
    font-size: 0.78em !important;
}

.nma-kt .kt-file-download {
    height: 22px;
    padding: 0 0.55em;
    font-size: 11.5px;
}

.nma-kt .kt-file-block {
    margin-bottom: 0.6em;
}

.nma-kt .kt-files-head {
    margin-bottom: 0.5em;
}

.nma-kt .kt-files-title {
    font-size: 14px;
}

/* names legend: smaller text, tighter rows */
.nma-kt .kt-names-legend,
.nma-kt .kt-files-col .kt-names-legend {
    padding: 0.45em 0.7em !important;
    font-size: 0.74em;
}

.nma-kt .kt-names-legend-title {
    margin-bottom: 0.25em;
}

.nma-kt .kt-names-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.1em 0.9em;
}

.nma-kt .kt-names-item {
    gap: 0.4em;
    line-height: 1.3;
}

.nma-kt .kt-names-abbr {
    min-width: 3.6em;
}

/* names legend: columns wide enough for long names (e.g. DEUCRAVA Deucravacitinib) */
.nma-kt .kt-names-list {
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
}

.nma-kt .kt-names-full {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* forest plots in the nested tables: can be dragged left / right */
.nma-kt .kt-forest-pan .nsewdrag,
.nma-kt .kt-forest-pan .drag {
    cursor: ew-resize !important;
}

/* "i" inside a table column title (e.g. Forest plot of the nested tables) */
.nma-kt .ag-header-cell .kt-header-info {
    flex: none;
    width: 18px !important;
    height: 18px !important;
    min-width: 0 !important;
    font-size: 11px !important;
    line-height: 18px !important;
}

/* "See R code" next to the outcome selection */
.nma-kt .kt-controls .kt-rcode-button {
    margin-left: 0.4em;
}

/* pairwise forest plot window: heterogeneity line under the title */
.kt-pairwise-het {
    margin: 0 0 0.6em;
    padding: 0.45em 0.8em;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-ink);
    background: #eef6f6;
    border-left: 3px solid var(--c-primary);
    border-radius: 6px;
}

.kt-pairwise-het:empty {
    display: none;
}

/* confidence rating "Very low": clearly darker than "Low" (white text) */
:is(.nma-kt, .kt-window) .ag-cell[style*="196, 71, 58"] {
    background: #c4473a !important;
    color: #ffffff !important;
    font-weight: 600;
}

.nma-kt .ag-cell[col-id^="Certainty"][style*="196, 71, 58"]:not(:empty)::after {
    color: #c4473a !important;
    background: #ffffff !important;
}

/* network heterogeneity (tau2) in the Overall info card: in bold, like the global inconsistency */
.nma-kt #kt_tau2 .kt-stat-label,
.nma-kt #kt_tau2_2 .kt-stat-label,
.nma-kt #kt_tau2 .kt-stat-value,
.nma-kt #kt_tau2_2 .kt-stat-value {
    font-weight: 700;
    color: var(--c-ink);
}

/* "Add to the forest plots": three even options, each box + label as one tidy chip */
.nma-kt .kt-option-checks {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em 0.6em !important;
}

.nma-kt .kt-option-checks label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5em !important;
    margin: 0 !important;
    padding: 0.35em 0.85em !important;
    font-size: 14px;
    line-height: 1.2;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 999px;
}

.nma-kt .kt-option-checks label:has(input:checked) {
    background: var(--c-primary-soft);
    border-color: #9fd0cc;
}

.nma-kt .kt-option-checks input[type="checkbox"] {
    flex: none;
    margin: 0 !important;
    position: static !important;
}

/* ---------- potential effect modifiers: Mean / Median switch and editable names ---------- */
.nma-kt .kt-mod-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4em 0.8em;
}

.nma-kt .kt-mod-stat {
    display: inline-flex;
    padding: 2px;
    background: var(--c-canvas);
    border: 1px solid var(--c-border);
    border-radius: 999px;
}

.nma-kt .kt-mod-stat label {
    display: inline-flex !important;
    align-items: center;
    margin: 0 !important;
    padding: 0.15em 0.75em;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-ink-muted);
    border-radius: 999px;
    cursor: pointer;
}

.nma-kt .kt-mod-stat input {
    display: none;
}

.nma-kt .kt-mod-stat label:has(input:checked) {
    color: #ffffff;
    background: var(--c-primary);
}

.nma-kt .kt-mod-hint {
    display: block;
    margin: 0.2em 0 0.3em;
    font-size: 12px;
    color: var(--c-ink-muted);
}

.nma-kt .kt-mod-label {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35em;
    min-width: 0;
}

.nma-kt .kt-mod-word {
    flex: none;
}

.nma-kt input.kt-mod-name {
    min-width: 0;
    width: 11em;
    max-width: 100%;
    padding: 1px 6px;
    font: inherit;
    color: var(--c-ink);
    background: transparent;
    border: 1px dashed transparent;
    border-radius: 6px;
}

.nma-kt input.kt-mod-name::placeholder {
    color: var(--c-ink);
    opacity: 1;
}

.nma-kt input.kt-mod-name:hover {
    border-color: #9fd0cc;
    background: #f4fbfa;
}

.nma-kt input.kt-mod-name:focus {
    outline: none;
    border: 1px solid var(--c-primary);
    background: #ffffff;
}

/* outcome choice: label and dropdown together (header: Detailed report; network box: KIT summary) */
.nma-kt .kt-outcome-field,
.kt-window .kt-outcome-field {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
}

.nma-kt .kt-outcome-inbox {
    margin-left: auto;
}

.nma-kt .kt-outcome-inbox .kt-control-title {
    font-size: 0.95em;
}

.nma-kt .kt-outcome-inbox .kt-outcome-select {
    min-width: 11em;
}

/* the two ranking buttons under the KIT summary network graph */
.nma-kt .kt-ranking-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.7em;
}

.nma-kt .kt-ranking-buttons .kt-ranking-button {
    margin-top: 0 !important;
}

/* ranking for two outcomes: the two outcome choices */
.kt-window .kt-rank2-select {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em 1.4em;
    margin-bottom: 0.7em;
}

.kt-window .kt-rank2-select .kt-outcome-select {
    min-width: 11em;
}

/* KIT summary network box: "Outcome" and its dropdown on one line, to the right of the title */
.nma-kt .kt-graph-head .kt-outcome-inbox {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    width: auto !important;
    max-width: none;
    padding: 0 !important;
}

.nma-kt .kt-graph-head .kt-outcome-inbox label {
    margin: 0 !important;
    white-space: nowrap;
}

/* KIT summary: the outcome next to Graph Options (same row) */
.nma-kt .network-toolbar-group .kt-outcome-inbox {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.5em;
    margin: 0 0 0 0.8em !important;
    padding: 0 !important;
    width: auto !important;
}

.nma-kt .network-toolbar-group .kt-outcome-inbox label {
    margin: 0 !important;
    white-space: nowrap;
}

.nma-kt .network-toolbar-group .kt-outcome-inbox .kt-outcome-select {
    min-width: 10em;
}

.nma-kt .network-toolbar-group:has(.kt-outcome-inbox) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em 0.8em;
}

.nma-kt .network-toolbar-group:has(.kt-outcome-inbox) > * {
    width: auto !important;
    flex: 0 0 auto;
}

.nma-kt .network-toolbar-group .kt-outcome-inbox {
    margin: 0 !important;
}

.nma-kt .network-toolbar-group .kt-outcome-inbox .kt-outcome-select {
    width: 12em !important;
    min-width: 0 !important;
}

/* Graph Options and Outcome always on one row: the outcome dropdown takes the space that is left */
.nma-kt .network-toolbar-group:has(.kt-outcome-inbox) {
    flex-wrap: nowrap !important;
}

.nma-kt .network-toolbar-group > .kt-outcome-inbox {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.nma-kt .network-toolbar-group .kt-outcome-inbox .kt-outcome-select {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 7em !important;
    max-width: 14em;
}

/* "✎ Click a name to rename it": the same chip as "✎ Click to type" (PICOS), on its own line */
.nma-kt .kt-edit-hint.kt-mod-hint {
    display: inline-block;
    width: fit-content;
    margin: 0.35em 0 0.45em;
}

/* modifier names look editable: a faint dashed underline (frame on hover / while typing) */
.nma-kt input.kt-mod-name {
    border-bottom: 1px dashed #9fd0cc;
    border-radius: 6px 6px 0 0;
}

.nma-kt .kt-edit-hint.kt-mod-hint {
    font-size: 14px !important;
    color: var(--c-primary-dark) !important;
}

/* =====================================================================
   "Download PDF" (assets/kt_pdf.js): the report as the browser prints it (body.kt-print)
   ===================================================================== */
@page {
    size: A4 landscape;
    margin: 10mm;
}

@media print {
    body.kt-print {
        background: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* only the report: no header, page controls, notes, tips, info buttons, chatbot, uploads, toolbars */
    body.kt-print .nma-header,
    body.kt-print header,
    body.kt-print .kt-controls,
    body.kt-print .ui-note,
    body.kt-print .kt-note,
    body.kt-print .results-network-hint,
    body.kt-print .nma-help-button,
    body.kt-print .kt-info-button,
    body.kt-print .kt-legend,
    body.kt-print .kt-edit-hint,
    body.kt-print .kt-mod-hint,
    body.kt-print .button-faq,
    body.kt-print .toast-faq,
    body.kt-print .kt-bot-section,
    body.kt-print .kt-file-block,
    body.kt-print .kt-files-head,
    body.kt-print #toast_upload,
    body.kt-print #trigger_info,
    body.kt-print .kt-graph-actions,
    body.kt-print .kt-ranking-buttons,
    body.kt-print .kt-network-tools > :not(.network-toolbar),
    body.kt-print .network-toolbar-icons,
    body.kt-print .graph-options,
    body.kt-print .panel-action,
    body.kt-print .panel-zoom-group,
    body.kt-print .sub-button,
    body.kt-print .kt-nested-toggle,
    body.kt-print .kt-mod-stat,
    body.kt-print .nma-scroll-hint,
    body.kt-print .ag-header-cell-menu-button,
    body.kt-print .modal,
    body.kt-print .modal-backdrop {
        display: none !important;
    }

    /* only the report that was shown */
    body.kt-print-detailed #skt_nonexpert_page,
    body.kt-print-summary #sky_expert_page {
        display: none !important;
    }

    /* the outcome of the KIT summary graph stays visible (as text, no dropdown arrow) */
    body.kt-print .kt-outcome-inbox .Select-arrow-zone { display: none !important; }

    /* full width, no shadows; boxes not split over two pages */
    body.kt-print .nma-kt,
    body.kt-print #kt_main_content {
        padding: 0 !important;
        background: #ffffff !important;
    }

    body.kt-print .ui-card,
    body.kt-print .skt_studyinfo,
    body.kt-print .tab1,
    body.kt-print .tab3_col,
    body.kt-print .tab3_col2 {
        box-shadow: none !important;
    }

    body.kt-print .row_skt:not(:has(.ag-root-wrapper)) {
        break-inside: avoid;
    }

    /* tables: every row and column shown (no scroll areas), a table starts on a new page */
    body.kt-print .ag-root-wrapper,
    body.kt-print .ag-root,
    body.kt-print .ag-body-viewport,
    body.kt-print .ag-center-cols-viewport,
    body.kt-print .ag-body-horizontal-scroll {
        overflow: visible !important;
    }

    body.kt-print .ag-body-horizontal-scroll,
    body.kt-print .ag-body-vertical-scroll {
        display: none !important;
    }

    body.kt-print .kt-table-info,
    body.kt-print #col_nonexpert {
        break-before: page;
    }

    /* the textarea of PICOS: its whole text */
    body.kt-print textarea {
        height: auto !important;
        min-height: 4em;
        overflow: visible !important;
        border-color: transparent !important;
        resize: none;
    }
}

/* "Download PDF" preparation: the report laid out at the printed page width (also on screen, briefly) */
body.kt-print-sizing #kt_main_content {
    width: 1040px !important;
    max-width: 1040px !important;
    margin: 0 auto !important;
}

@media print {
    /* screen-only marks in the tables: column menus, pencils, click / hover marks */
    body.kt-print .ag-header-icon.ag-header-cell-menu-button,
    body.kt-print .ag-header-cell .kt-header-info {
        display: none !important;
    }

    body.kt-print .ag-cell::after,
    body.kt-print .ag-cell::before,
    body.kt-print .ag-header-cell::after,
    body.kt-print .kt-editable-header .ag-header-cell-label::after {
        content: none !important;
        display: none !important;
    }
}

@media print {
    body.kt-print #kt_main_content .ag-cell[col-id]:not(.kt-print-x)::after,
    body.kt-print #kt_main_content .ag-cell[col-id]:not(.kt-print-x):not(:empty)::after,
    body.kt-print #kt_main_content .ag-header-cell .ag-header-cell-comp-wrapper::after {
        content: none !important;
        display: none !important;
    }

    body.kt-print #kt_main_content .ag-header-cell .ag-header-icon.ag-header-cell-menu-button {
        display: none !important;
    }
}

@media print {
    /* KIT summary table: all rows (no 1000 px box with its own scroll) */
    body.kt-print #grid_treat_compare,
    body.kt-print #grid_treat_compare > div {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
    }

    body.kt-print .nma-scroll-fade,
    body.kt-print .nma-scroll-fade-down,
    body.kt-print .nma-scroll-fade-right {
        display: none !important;
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }

    body.kt-print [class*="nma-scroll"] {
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }
}

/* "Download PDF" in progress: spinning icon, text and a Stop button (assets/kt_pdf.js) */
.nma-kt .kt-pdf-status {
    align-items: center;
    gap: 0.55em;
    margin-left: 0.4em;
    padding: 0.25em 0.4em 0.25em 0.75em;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border: 1px solid #b9dedb;
    border-radius: 999px;
}

.nma-kt .kt-pdf-spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid #b9dedb;
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: kt-pdf-spin 0.8s linear infinite;
}

@keyframes kt-pdf-spin {
    to { transform: rotate(360deg); }
}

.nma-kt .kt-pdf-stop {
    padding: 0.15em 0.75em;
    font-size: 13px;
    font-weight: 700;
    color: #a3352a;
    background: #ffffff;
    border: 1px solid #f0b7aa;
    border-radius: 999px;
    cursor: pointer;
}

.nma-kt .kt-pdf-stop:hover {
    color: #ffffff;
    background: #c4473a;
    border-color: #c4473a;
}

/* "Download PDF": cover in front of the page while it is prepared (assets/kt_pdf.js) */
#kt-pdf-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(246, 248, 250, 0.82);  /* a little see-through */
}

#kt-pdf-overlay .kt-pdf-card {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 1.1em 1.4em;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    border: 1px solid #dfe6ec;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(29, 43, 58, 0.15);
}

#kt-pdf-overlay .kt-pdf-spinner {
    flex: none;
    width: 28px;
    height: 28px;
    border: 3.5px solid #cfe8e6;
    border-top-color: #1f8a8a;
    border-radius: 50%;
    animation: kt-pdf-spin 0.8s linear infinite;
}

#kt-pdf-overlay .kt-pdf-title {
    font-size: 16px;
    font-weight: 700;
    color: #1d2b3a;
}

#kt-pdf-overlay .kt-pdf-sub {
    margin-top: 0.15em;
    font-size: 13.5px;
    color: #5b6b7b;
}

#kt-pdf-overlay .kt-pdf-stop {
    margin-left: 0.6em;
    padding: 0.35em 1em;
    font-size: 14px;
    font-weight: 700;
    color: #a3352a;
    background: #ffffff;
    border: 1px solid #f0b7aa;
    border-radius: 999px;
    cursor: pointer;
}

#kt-pdf-overlay .kt-pdf-stop:hover {
    color: #ffffff;
    background: #c4473a;
    border-color: #c4473a;
}

@media print {
    #kt-pdf-overlay,
    body.kt-print .kt-options-row,
    body.kt-print .kt-options-card {
        display: none !important;
    }

    /* network graphs centred in their boxes */
    body.kt-print #cytoscape_skt,
    body.kt-print #cytoscape_skt2 {
        margin: 0 auto !important;
    }
}

/* "Download PDF": solid teal */
.nma-kt .sub-button.kt-pdf-button {
    color: #ffffff !important;
    background: var(--c-primary) !important;
    border-color: var(--c-primary) !important;
}

.nma-kt .sub-button.kt-pdf-button:hover:not(:disabled) {
    background: var(--c-primary-dark) !important;
    border-color: var(--c-primary-dark) !important;
}

.nma-kt .sub-button.kt-pdf-button:disabled {
    opacity: 0.6;
}

@media print {
    /* the forest plot options are not part of the PDF (stronger than the row layout rules) */
    body.kt-print #sky_expert_page .row_skt.kt-options-row,
    body.kt-print #sky_expert_page .kt-options-card {
        display: none !important;
    }
}

/* "Download PDF" with 3 or more outcomes (KIT summary): choose two (assets/kt_pdf.js) */
#kt-pdf-choose {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(29, 43, 58, 0.35);
}

#kt-pdf-choose .kt-pdf-choose-card {
    display: block;
    max-width: 30em;
    padding: 1.3em 1.5em;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(29, 43, 58, 0.2);
}

#kt-pdf-choose .kt-pdf-title { font-size: 16px; font-weight: 700; color: #1d2b3a; }
#kt-pdf-choose .kt-pdf-sub { margin: 0.35em 0 0.9em; font-size: 13.5px; line-height: 1.45; color: #5b6b7b; }

#kt-pdf-choose .kt-pdf-outs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 1.1em;
}

#kt-pdf-choose .kt-pdf-out {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    margin: 0;
    padding: 0.35em 0.85em;
    font-size: 14px;
    color: #1d2b3a;
    border: 1px solid #dfe6ec;
    border-radius: 999px;
    cursor: pointer;
}

#kt-pdf-choose .kt-pdf-out:has(input:checked) { background: #e3f0ef; border-color: #9fd0cc; }
#kt-pdf-choose .kt-pdf-out:has(input:disabled) { opacity: 0.5; cursor: default; }
#kt-pdf-choose .kt-pdf-out input { accent-color: #1f8a8a; margin: 0; }

#kt-pdf-choose .kt-pdf-choose-actions { display: flex; justify-content: flex-end; gap: 0.6em; }

#kt-pdf-choose .kt-pdf-stop {
    padding: 0.4em 1em;
    font-size: 14px;
    font-weight: 700;
    color: #5b6b7b;
    background: #ffffff;
    border: 1px solid #dfe6ec;
    border-radius: 999px;
    cursor: pointer;
}

#kt-pdf-choose .kt-pdf-go {
    padding: 0.4em 1.1em;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    background: #1f8a8a;
    border: 1px solid #1f8a8a;
    border-radius: 999px;
    cursor: pointer;
}

#kt-pdf-choose .kt-pdf-go:disabled { opacity: 0.5; cursor: default; }

@media print { #kt-pdf-choose { display: none !important; } }

/* the chooser's own look wins over the app's general button / label styles */
#kt-pdf-choose .kt-pdf-out {
    padding: 0.35em 0.85em !important;
    border: 1px solid #dfe6ec !important;
    border-radius: 999px !important;
    background: #ffffff !important;
}

#kt-pdf-choose .kt-pdf-out:has(input:checked) {
    background: #e3f0ef !important;
    border-color: #9fd0cc !important;
}

#kt-pdf-choose button.kt-pdf-go {
    display: inline-block !important;
    padding: 0.4em 1.1em !important;
    color: #ffffff !important;
    background: #1f8a8a !important;
    border: 1px solid #1f8a8a !important;
    border-radius: 999px !important;
    opacity: 1;
}

#kt-pdf-choose button.kt-pdf-go:disabled { opacity: 0.5 !important; }

#kt-pdf-choose button.kt-pdf-stop {
    display: inline-block !important;
    padding: 0.4em 1em !important;
    color: #5b6b7b !important;
    background: #ffffff !important;
    border: 1px solid #dfe6ec !important;
    border-radius: 999px !important;
}

#kt-pdf-choose .kt-pdf-choose-card {
    border-radius: 14px !important;
}

/* "Download PDF": the network graphs as pictures of the whole graph, centred in their boxes */
img.kt-print-netimg { display: none; }

@media print {
    body.kt-print img.kt-print-netimg {
        display: block !important;
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: 520px;
        margin: 0.4em auto;
        object-fit: contain;
    }

    body.kt-print #cytoscape_skt,
    body.kt-print #cytoscape_skt2 {
        display: none !important;
    }
}

/* p-value (consistency) of a nested table: click it for the direct vs indirect forest plot */
.nma-kt .ag-details-row .ag-cell[col-id="p-value"]:not(:empty)::after {
    content: "↗";
    position: absolute;
    top: 6px;
    right: 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: #1f8a8a;
    opacity: 0.75;
    pointer-events: none;
}

.nma-kt .ag-details-row .ag-cell[col-id="p-value"]:not(:empty) {
    cursor: pointer;
}

.nma-kt .ag-details-row .ag-cell[col-id="p-value"]:not(:empty):hover {
    background: #eaf5f4 !important;
    box-shadow: inset 0 0 0 1px #b9dedb;
}

/* KIT summary: a cell without an estimate cannot be clicked (no mark, no pointer, no highlight) */
.nma-kt #grid_treat_compare .ag-cell.kt-no-value {
    cursor: default !important;
    pointer-events: none;
}

.nma-kt #grid_treat_compare .ag-cell.kt-no-value::after {
    content: none !important;
    display: none !important;
}

/* window of a KIT summary effect: Bars / Dots next to the graph buttons */
.kt-window .kt-chart-style-tools {
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* "See all studies" (PICOS box) and its window */
.nma-kt .kt-all-studies-button {
    margin-top: 10px;
    justify-self: start;
}
.kt-window .kt-all-studies-note {
    font-size: 13px;
    color: #5b6b7b;
    margin: 4px 0 10px;
}

/* "Potential effect modifiers": SD (with the mean) / IQR (with the median) after the value */
.nma-kt .kt-mod-spread {
    font-weight: 400;
    color: #5b6b7b;
    font-size: 0.9em;
    white-space: nowrap;
}

/* "+" / "−" in the confidence rating titles: show / hide the CINeMA domain columns */
.kt-domain-toggle {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #1f8a8a;
    background: #ffffff;
    color: #1f8a8a;
    font-weight: 700;
    font-size: 14px;
    line-height: 17px;
    text-align: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.kt-domain-toggle:hover,
.kt-domain-toggle.is-open {
    background: #1f8a8a;
    color: #ffffff;
}
.ag-header-cell.kt-domain-header {
    background: #f4f8f9;
}

/* KIT summary: "Relative effects" / "Absolute differences" above the table */
.nma-kt .kt-effect-mode {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px 0 10px;
}
.nma-kt .kt-effect-mode-note {
    font-size: 13px;
    color: #5b6b7b;
}

/* "Download" above the study tables (effect window, "See all studies") */
.kt-window .kt-table-tools {
    display: flex;
    justify-content: flex-end;
    margin: 4px 0 6px;
}
.kt-window .kt-table-tools .panel-action {
    border: none;
    background: none;
    padding: 0;
}
