/* =====================================================================
   NMAstudio modern theme (pilot)
   Opt-in: add className="nma-modern" to a page's root element.
   The app header (tools/navbar.py) uses the same tokens via .nma-header.
   Everything here is scoped under .nma-modern, so pages without the
   class keep the old look. Used by: CINeMA page, Setup page.

   Note: app.css sets html{font-size:62%}, so rem is ~10px in this app.
   Sizes below use em, relative to the base font-size set on .nma-modern.
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* design tokens: shared by the restyled pages, the app header and themed modals */
.nma-modern,
.nma-header,
.nma-modal {
    /* palette: calm teal + navy, warm coral accent for a touch of cheer */
    --c-primary: #1f8a8a;
    --c-primary-dark: #156b6c;
    --c-primary-soft: #e6f4f3;
    --c-accent: #f2836b;
    --c-accent-dark: #d9654c;
    --c-accent-soft: #fdeee9;
    --c-ink: #1d2b3a;
    --c-ink-muted: #5b6b7b;
    --c-surface: #ffffff;
    --c-canvas: #f6f8fa;
    --c-border: #dfe6ec;
    --c-success: #2e9d6a;
    --c-danger: #c94a3c;
    --radius-lg: 14px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(29, 43, 58, 0.06), 0 1px 3px rgba(29, 43, 58, 0.08);
    --shadow-md: 0 4px 12px rgba(29, 43, 58, 0.08);
    --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.nma-modern {
    font-family: var(--font-ui);
    font-size: clamp(16px, 0.6vw + 11px, 19px);
    line-height: 1.5;
    color: var(--c-ink);
    background: var(--c-canvas);
    min-height: 100vh;
    padding: clamp(1.5em, 4vw, 3em) clamp(1em, 4vw, 3em) 3em;
    -webkit-font-smoothing: antialiased;
}

/* ---------- page header ---------- */

.nma-modern .ui-hero {
    max-width: 1040px;
    margin: 0 auto 2em;
    padding: 1.75em 2em;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 5px solid var(--c-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.nma-modern .ui-eyebrow {
    display: inline-block;
    padding: 0.2em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-accent-dark);
    background: var(--c-accent-soft);
    border-radius: 999px;
}

.nma-modern .ui-heading {
    margin: 0.6em 0 0.5em;
    font-family: var(--font-ui);
    font-size: clamp(1.5em, 2.5vw, 1.9em);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--c-ink);
}

.nma-modern .ui-intro {
    max-width: 62ch;
    margin: 0 0 1.25em;
    font-size: 1em;
    line-height: 1.6;
    color: var(--c-ink-muted);
}

/* compact header: text on the left, actions on the right (Setup, CINeMA) */
.nma-modern:has(> .ui-hero-compact) {
    padding-top: clamp(1em, 2vw, 1.5em);
}

.nma-modern .ui-hero.ui-hero-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1em 2em;
    margin-bottom: 1.25em;
    padding: 1.1em 1.6em;
}

.nma-modern .ui-hero-compact .ui-hero-text {
    flex: 1 1 12em;
    min-width: 0;
}

.nma-modern .ui-hero-compact .ui-hero-actions {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
}

.nma-modern .ui-hero-compact .ui-heading {
    margin: 0.35em 0 0.2em;
    font-size: clamp(1.3em, 2vw, 1.55em);
}

.nma-modern .ui-hero-compact .ui-intro {
    margin: 0;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .nma-modern .ui-hero.ui-hero-compact {
        padding: 1.25em;
    }
}

/* ---------- buttons ---------- */

.nma-modern .ui-button,
.nma-modern .ui-button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    min-height: 2.4em;
    padding: 0.45em 1.1em;
    font-family: var(--font-ui);
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    height: auto;
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.nma-modern .ui-button {
    color: #fff;
    background: var(--c-primary);
    border: 1px solid var(--c-primary);
}

.nma-modern .ui-button:hover:not(:disabled),
.nma-modern .ui-button:focus-visible {
    color: #fff;
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
    transform: translateY(-1px);
}

.nma-modern .ui-button-secondary {
    color: var(--c-primary-dark);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
}

.nma-modern .ui-button-secondary:hover:not(:disabled),
.nma-modern .ui-button-secondary:focus-visible {
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
}

.nma-modern .ui-button:disabled,
.nma-modern .ui-button-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* a cheerful call-to-action variant */
.nma-modern .ui-button-accent {
    background: var(--c-accent);
    border-color: var(--c-accent);
}

.nma-modern .ui-button-accent:hover:not(:disabled),
.nma-modern .ui-button-accent:focus-visible {
    background: var(--c-accent-dark);
    border-color: var(--c-accent-dark);
}

/* ---------- cards ---------- */

.nma-modern .ui-card {
    padding: 1.25em 1.4em;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease;
}

.nma-modern .ui-card:hover {
    box-shadow: var(--shadow-md);
}

.nma-modern .ui-card-header {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 1em;
}

.nma-modern .ui-badge {
    flex: none;
    display: grid;
    place-items: center;
    width: 2em;
    height: 2em;
    font-weight: 700;
    font-size: 0.9em;
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border-radius: 50%;
}

.nma-modern .ui-card-title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--c-ink);
}

.nma-modern .ui-subtitle {
    margin: 0.75em 0 0.5em;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--c-ink);
}

/* ---------- side note ---------- */

.nma-modern .ui-note {
    display: flex;
    gap: 0.75em;
    padding: 1em 1.1em;
    font-size: 0.9em;
    line-height: 1.55;
    color: var(--c-ink);
    background: var(--c-accent-soft);
    border-radius: var(--radius-lg);
    white-space: pre-line;
}

.nma-modern .ui-note-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.5em;
    height: 1.5em;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    color: #fff;
    background: var(--c-accent);
    border-radius: 50%;
}

.nma-modern .ui-note a {
    color: var(--c-primary-dark);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- file drop zone ---------- */

.nma-modern .ui-dropzone {
    cursor: pointer;
    border: 2px dashed var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-canvas);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.nma-modern .ui-dropzone:hover {
    border-color: var(--c-primary);
    background: var(--c-primary-soft);
}

.nma-modern .ui-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2em;
    padding: 1.1em 1em;
    text-align: center;
    font-size: 0.95em;
    color: var(--c-ink);
}

.nma-modern .ui-dropzone-icon {
    font-size: 1.4em;
    line-height: 1;
    color: var(--c-primary);
}

.nma-modern .ui-dropzone-link {
    font-weight: 600;
    color: var(--c-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nma-modern .ui-dropzone-hint {
    font-size: 0.8em;
    color: var(--c-ink-muted);
}

.nma-modern .ui-filename {
    min-height: 1.5em;
    margin: 0.6em 0 0;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--c-success);
    overflow-wrap: anywhere;
}

.nma-modern .ui-filename:empty {
    min-height: 0;
    margin: 0;
}

.nma-modern .ui-filename:not(:empty)::before {
    content: "✓ ";
}

/* ---------- form controls ---------- */

.nma-modern .ui-input {
    width: 100%;
    min-width: 0;
    height: 2.4em;
    padding: 0.4em 0.75em;
    font-family: var(--font-ui);
    font-size: 0.95em;
    color: var(--c-ink);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nma-modern .ui-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.nma-modern .ui-input::placeholder {
    color: #9aa7b3;
}

.nma-modern .ui-input-row {
    display: flex;
    gap: 0.6em;
    align-items: center;
}

/* radio / checkbox groups rendered as soft pills */
.nma-modern .ui-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.nma-modern .ui-choices label {
    /* !important: dcc.RadioItems/Checklist put an inline display on each label */
    display: inline-flex !important;
    align-items: center;
    gap: 0.45em;
    margin: 0;
    padding: 0.4em 0.9em;
    font-size: 0.95em;
    font-weight: 500;
    color: var(--c-ink);
    background: var(--c-canvas);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.nma-modern .ui-choices label:hover {
    border-color: var(--c-primary);
}

.nma-modern .ui-choices label:has(input:checked) {
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
}

.nma-modern .ui-choices input {
    accent-color: var(--c-primary);
    margin: 0;
}

/* "Skip" options: same pill, warm accent */
.nma-modern .ui-choices-skip label:has(input:checked) {
    color: var(--c-accent-dark);
    background: var(--c-accent-soft);
    border-color: var(--c-accent);
}

.nma-modern .ui-choices-skip input {
    accent-color: var(--c-accent);
}

/* dcc.Dropdown (react-select) */
.nma-modern .ui-dropdown {
    font-family: var(--font-ui);
    font-size: 0.95em;
    color: var(--c-ink);
}

.nma-modern .ui-dropdown .Select-control {
    min-height: 2.4em;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.nma-modern .ui-dropdown.is-focused .Select-control,
.nma-modern .ui-dropdown .is-focused .Select-control {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}

/* label + control pairs */
.nma-modern .ui-field-grid {
    display: grid;
    gap: 0.6em;
}

.nma-modern .ui-field {
    display: grid;
    grid-template-columns: minmax(7em, 11em) minmax(0, 1fr);
    gap: 0.75em;
    align-items: center;
}

.nma-modern .ui-field-label {
    margin: 0;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--c-ink-muted);
    text-align: right;
}

@media (max-width: 600px) {
    .nma-modern .ui-field {
        grid-template-columns: 1fr;
    }

    .nma-modern .ui-field-label {
        text-align: left;
    }
}

/* bulleted list inside a side note */
.nma-modern .ui-note .ui-note-list {
    margin: 0;
    padding-left: 1.1em;
    white-space: normal;
    list-style: disc;
}

.nma-modern .ui-note .ui-note-list,
.nma-modern .ui-note .ui-note-list li {
    color: var(--c-ink) !important;
    opacity: 1;
    font-size: 1em;
}

.nma-modern .ui-note .ui-note-list li {
    margin: 0 0 0.25em;
    line-height: 1.45;
}

.nma-modern .ui-note .ui-note-list li:last-child {
    margin-bottom: 0;
}

/* ---------- empty state: page has nothing to show yet ---------- */

.nma-modern .ui-empty-state {
    display: flex;
    justify-content: center;
    padding-top: clamp(1em, 6vh, 4em);
}

.nma-modern .ui-empty-card {
    max-width: 620px;
    padding: 2em 2.25em;
    text-align: left;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 5px solid var(--c-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.nma-modern .ui-empty-card .ui-intro {
    margin-bottom: 1em;
}

.nma-modern .ui-empty-steps {
    margin: 0 0 1.5em;
    padding-left: 1.3em;
    color: var(--c-ink);
    list-style: decimal;
}

.nma-modern .ui-empty-steps li {
    margin: 0 0 0.35em;
    font-size: 0.95em;
    line-height: 1.5;
    color: var(--c-ink) !important;
}

/* the empty-state page wrapper: no page background (the Results container is narrower than the window) */
.nma-modern.ui-empty-page {
    background: transparent;
    min-height: 0;
}


/* =====================================================================
   Themed modal (analysis progress window): modal_class_name="nma-modal"
   Bootstrap renders modals outside the page, so the .nma-modern rules
   above don't reach them; the pieces used here are repeated for .nma-modal.
   ===================================================================== */

.nma-modal .modal-dialog {
    max-width: min(760px, calc(100vw - 32px));
}

.nma-modal .modal-content {
    font-family: var(--font-ui);
    font-size: clamp(15px, 0.5vw + 10px, 17px);
    line-height: 1.5;
    color: var(--c-ink);
    background: var(--c-surface);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(29, 43, 58, 0.25);
    overflow: hidden;
}

.nma-modal .modal-header {
    align-items: flex-start;
    font-size: 1em; /* app.css sets x-large on every modal header */
    background: var(--c-surface); /* app.css: grey-teal */
    padding: 1.2em 1.5em 1em;
    border-bottom: 1px solid var(--c-border);
    border-left: 5px solid var(--c-primary);
}

.nma-modal .nma-modal-title {
    margin: 0.35em 0 0;
    font-family: var(--font-ui);
    font-size: 1.45em;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--c-ink);
}

.nma-modal .ui-eyebrow {
    display: inline-block;
    padding: 0.2em 0.65em;
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-accent-dark);
    background: var(--c-accent-soft);
    border-radius: 999px;
}

.nma-modal .modal-body {
    padding: 1.25em 1.5em;
    background: var(--c-canvas);
}

/* methods note */
.nma-modal .ui-note {
    display: flex;
    gap: 0.75em;
    margin-bottom: 1.1em;
    padding: 0.9em 1em;
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--c-ink);
    background: var(--c-accent-soft);
    border-radius: var(--radius-md);
}

.nma-modal .ui-note-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.5em;
    height: 1.5em;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    color: #fff;
    background: var(--c-accent);
    border-radius: 50%;
}

.nma-modal .ui-note-list {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding-left: 1.1em;
    list-style: disc;
    white-space: normal;
}

.nma-modal .ui-note-list li {
    margin: 0 0 0.3em; /* style.css adds a left margin to every li */
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 1em;
    color: var(--c-ink) !important;
}

.nma-modal .ui-note-list li:last-child {
    margin-bottom: 0;
}

/* analysis steps */
.nma-modal .nma-analysis-steps {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.nma-modal .nma-analysis-step {
    display: grid;
    grid-template-columns: auto minmax(0, 15em) minmax(0, 1fr);
    gap: 0.75em;
    align-items: center;
    min-height: 3.4em;
    padding: 0.6em 1em;
    border-top: 1px solid var(--c-border);
}

.nma-modal .nma-analysis-step:first-child {
    border-top: none;
}

.nma-modal .ui-badge {
    display: grid;
    place-items: center;
    width: 1.9em;
    height: 1.9em;
    font-size: 0.85em;
    font-weight: 700;
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border-radius: 50%;
}

.nma-modal .nma-analysis-step-label {
    font-weight: 600;
    color: var(--c-ink);
}

.nma-modal .nma-analysis-step-status {
    min-width: 0;
    font-size: 0.92em;
}

.nma-modal .nma-analysis-step-status ._dash-loading-callback,
.nma-modal .nma-analysis-step-status > div {
    display: flex;
    align-items: center;
    min-height: 1.5em;
}

.nma-modal .nma-analysis-step-status p {
    margin: 0;
    line-height: 1.45;
}

/* status messages come from the analysis code with plain green/orange/red: use theme colours */
.nma-modal .nma-analysis-step-status p[style*="green"] {
    color: var(--c-success) !important;
    font-weight: 500;
}

.nma-modal .nma-analysis-step-status p[style*="orange"] {
    color: #b86a12 !important;
}

.nma-modal .nma-analysis-step-status p[style*="red"] {
    color: var(--c-danger) !important;
    font-weight: 500;
}

/* treatment names check */
.nma-modal .nma-modal-check {
    margin-top: 1.1em;
}

.nma-modal .nma-modal-check-label {
    margin: 0 0 0.4em;
    font-size: 0.92em;
    font-weight: 600;
    color: var(--c-ink);
}

.nma-modal .ui-dropdown {
    font-family: var(--font-ui);
    font-size: 0.95em;
}

.nma-modal .ui-dropdown .Select-control {
    min-height: 2.4em;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

/* footer */
.nma-modal .modal-footer {
    justify-content: flex-end; /* app.css: space-between */
    padding: 0.9em 1.5em;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
}

.nma-modal .ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 2.5em;
    padding: 0.45em 1.6em;
    font-family: var(--font-ui);
    font-size: 1em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    color: #fff;
    background: var(--c-primary);
    border: 1px solid var(--c-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease;
}

.nma-modal .ui-button:hover:not(:disabled) {
    background: var(--c-primary-dark);
    border-color: var(--c-primary-dark);
}

.nma-modal .ui-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .nma-modal .nma-analysis-step {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .nma-modal .nma-analysis-step-status {
        grid-column: 2;
    }
}

/* treatment names to check, shown as pills */
.nma-modal .nma-treatment-box {
    max-height: 12em;
    overflow-y: auto;
    padding: 0.75em 0.9em;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.nma-modal .nma-treatment-box:empty {
    display: none;
}

.nma-modal .nma-treatment-count {
    display: block;
    margin-bottom: 0.5em;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--c-ink-muted);
}

.nma-modal .nma-treatment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
}

.nma-modal .nma-treatment-chip {
    padding: 0.25em 0.7em;
    font-size: 0.88em;
    font-weight: 500;
    color: var(--c-primary-dark);
    background: var(--c-primary-soft);
    border-radius: 999px;
}

/* ---------- help "?" buttons and their windows (assets/Infos/info.py) ---------- */

.nma-help-button {
    /* same symbol and colour as .ui-note-icon (setup page notes) */
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin: 0 6px;
    padding: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 14px;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    color: #fff;
    background: #f2836b;
    border: none;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(29, 43, 58, 0.15);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.nma-help-button:hover,
.nma-help-button:focus-visible {
    color: #fff;
    background: #d9654c;
    transform: scale(1.08);
    outline: none;
}

.nma-help-modal .modal-dialog {
    max-width: min(620px, calc(100vw - 32px));
}

.nma-help-modal .modal-body {
    background: var(--c-surface);
    font-size: 0.95em;
    line-height: 1.6;
}

/* help texts carry inline font sizes / colours: use the theme ones */
.nma-help-modal .modal-body,
.nma-help-modal .modal-body * {
    font-family: var(--font-ui) !important;
    font-size: 1em !important;
    color: var(--c-ink) !important;
    text-align: left !important;
}

.nma-help-modal .modal-body p {
    margin: 0 0 0.6em;
}

/* sections inside an info window (one per topic) */
.nma-help-modal .nma-help-section + .nma-help-section {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid var(--c-border);
}

.nma-help-modal .modal-body .nma-help-section-title {
    margin: 0 0 0.35em;
    font-size: 1.05em !important;
    font-weight: 700;
    color: var(--c-primary-dark) !important;
}

/* ---------- custom colour windows (results page, Graph Options) ---------- */

.nma-color-modal .modal-dialog {
    max-width: min(460px, calc(100vw - 32px));
}

.nma-color-modal .modal-body {
    background: var(--c-surface);
}

.nma-color-modal .nma-color-intro {
    margin: 0 0 0.9em;
    font-size: 0.95em;
    color: var(--c-ink-muted);
}

.nma-color-modal .nma-color-swatches {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.45em;
    margin-bottom: 1.1em;
}

.nma-color-modal .nma-color-swatch {
    aspect-ratio: 1;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: 2px solid var(--c-surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--c-border);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.nma-color-modal .nma-color-swatch:hover,
.nma-color-modal .nma-color-swatch:focus-visible {
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--c-primary);
    outline: none;
}

.nma-color-modal .nma-color-field {
    display: grid;
    gap: 0.35em;
    margin: 0;
}

.nma-color-modal .nma-color-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--c-ink);
}

.nma-color-modal .nma-color-input {
    width: 100%;
    height: 2.4em;
    padding: 0.4em 0.75em;
    font-family: var(--font-ui);
    font-size: 0.95em;
    color: var(--c-ink);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.nma-color-modal .nma-color-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}

/* ---------- all dropdowns (dcc.Dropdown): text centred vertically, clear arrow ---------- */
.nma-modern .Select-control,
.nma-modal .Select-control {
    display: flex !important;
    align-items: center;
    min-height: 2.3em;
    height: auto !important;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.nma-modern .Select-multi-value-wrapper,
.nma-modal .Select-multi-value-wrapper {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    align-self: stretch;
    min-width: 0;
}

.nma-modern .Select--single > .Select-control .Select-value,
.nma-modern .Select-placeholder,
.nma-modal .Select--single > .Select-control .Select-value,
.nma-modal .Select-placeholder {
    top: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center;
    padding: 0 0.75em !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nma-modern .Select-value-label,
.nma-modal .Select-value-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.nma-modern .Select-input,
.nma-modal .Select-input {
    height: auto !important;
    padding-left: 0.75em;
}

.nma-modern .Select-arrow-zone,
.nma-modal .Select-arrow-zone {
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2em !important;
    padding: 0 0.5em 0 0 !important;
    visibility: visible !important;
}

.nma-modern .Select-arrow,
.nma-modal .Select-arrow {
    display: block !important;
    border-color: var(--c-ink-muted) transparent transparent !important;
    border-style: solid !important;
    border-width: 6px 5px 0 !important;
}

.nma-modern .Select.is-open .Select-arrow,
.nma-modal .Select.is-open .Select-arrow {
    border-color: transparent transparent var(--c-ink-muted) !important;
    border-width: 0 5px 6px !important;
}

.nma-modern .Select-clear-zone,
.nma-modal .Select-clear-zone {
    display: flex;
    align-items: center;
}

/* ---------- "i" info pop-ups (NMA-KIT; tools/kt_info.py) ---------- */
.popover.nma-info-pop {
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 0 !important;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d2b3a !important;
    background: #ffffff !important;
    border: 1px solid #dfe6ec;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(29, 43, 58, 0.18);
    overflow: hidden;
    z-index: 2000;
}

.popover.nma-info-pop::after {
    display: none;
}

.popover.nma-info-pop .popover-arrow::after {
    border-top-color: #fdeee9;
    border-bottom-color: #ffffff;
}

.popover.nma-info-pop .popover-body {
    padding: 0;
    color: #1d2b3a;
}

.nma-info-pop-title {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.6em 0.85em;
    font-size: 14px;
    font-weight: 700;
    color: #1d2b3a;
    background: #fdeee9;
    border-bottom: 1px solid #f7d2c6;
}

.nma-info-pop-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    font-family: Georgia, serif;
    font-size: 12px;
    font-style: italic;
    font-weight: 700;
    color: #fff;
    background: #f2836b;
    border-radius: 50%;
}

.nma-info-pop-body {
    padding: 0.65em 0.85em 0.7em;
    font-size: 13px;
    line-height: 1.5;
}

.nma-info-pop-body p {
    margin: 0 0 0.45em;
    color: #1d2b3a !important;
    font-size: 13px !important;
}

.nma-info-pop-body p:last-child {
    margin-bottom: 0;
}

/* =====================================================================
   Scrolling: scrollbars always visible (macOS hides them until you scroll), plus hints at the edge
   of any box with more content below or to the right (assets/scroll_hints.js).
   ===================================================================== */
.nma-modern,
.nma-modal {
    scrollbar-color: #b9c6d2 #eef2f6;  /* Firefox */
}

.nma-modern ::-webkit-scrollbar,
.nma-modal ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.nma-modern ::-webkit-scrollbar-track,
.nma-modal ::-webkit-scrollbar-track {
    background: #eef2f6;
    border-radius: 6px;
}

.nma-modern ::-webkit-scrollbar-thumb,
.nma-modal ::-webkit-scrollbar-thumb {
    background: #b9c6d2;
    border: 2px solid #eef2f6;
    border-radius: 6px;
}

.nma-modern ::-webkit-scrollbar-thumb:hover,
.nma-modal ::-webkit-scrollbar-thumb:hover {
    background: #8a99a8;
}

.nma-scroll-fade {
    position: fixed;
    pointer-events: none;
}

.nma-scroll-fade-down {
    height: 34px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
}

.nma-scroll-fade-right {
    width: 34px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.95));
}

.nma-scroll-hint {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 0.35em;
    height: 28px;
    padding: 0 0.8em;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: #fff;
    background: rgba(21, 107, 108, 0.92);  /* teal, as the buttons */
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(29, 43, 58, 0.18);
    cursor: pointer;
    user-select: none;
    animation: nma-scroll-nudge 1.8s ease-in-out infinite;
}

.nma-scroll-hint:hover {
    background: #1f8a8a;
    animation: none;
}

.nma-scroll-hint-right {
    animation-name: nma-scroll-nudge-right;
}

@keyframes nma-scroll-nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

@keyframes nma-scroll-nudge-right {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
    .nma-scroll-hint { animation: none; }
}

/* two-choice switches (Box plot / Scatter plot on Results and NMA-KIT): teal on both sides, not grey */
#box_vs_scatter .daq-toggleswitch--light__background,
#box_kt_scatter .daq-toggleswitch--light__background,
#rob_vs_cinema .daq-toggleswitch--light__background,
#rob_vs_cinema-both .daq-toggleswitch--light__background {
    background: #cfe8e6 !important;
    border: 1px solid #9fd0cc !important;
}

#box_vs_scatter .daq-toggleswitch--light__button,
#box_kt_scatter .daq-toggleswitch--light__button,
#rob_vs_cinema .daq-toggleswitch--light__button,
#rob_vs_cinema-both .daq-toggleswitch--light__button {
    background: #1f8a8a !important;
    border-color: #fff !important;
    box-shadow: 0 1px 3px rgba(29, 43, 58, 0.25);
}

#box_vs_scatter [class*="daq-toggleswitch--light__indicator"],
#box_kt_scatter [class*="daq-toggleswitch--light__indicator"],
#rob_vs_cinema [class*="daq-toggleswitch--light__indicator"],
#rob_vs_cinema-both [class*="daq-toggleswitch--light__indicator"] {
    display: none !important;
}

/* ---------- "See R code" window (tools/r_code.py), Results page and NMA-KIT ---------- */
.nma-rcode-modal .nma-rcode-intro {
    margin: 0 0 0.9em;
    font-size: 15px;
    line-height: 1.55;
    color: var(--c-ink);
}

.nma-rcode-modal .nma-rcode-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
    margin-bottom: 0.9em;
}

.nma-rcode-modal .nma-rcode-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    cursor: pointer;
}

.nma-rcode-modal .nma-rcode-pre {
    max-height: 60vh;
    margin: 0;
    padding: 1em 1.2em;
    overflow: auto;
    font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre;
    color: #1d2b3a;
    background: #f5f8fa;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.nma-rcode-modal .nma-rcode-pre code {
    font: inherit;
    color: inherit;
    white-space: inherit;
}

/* switch disabled (no CINeMA report yet): faded, still teal */
#rob_vs_cinema [class*="disabled"], #rob_vs_cinema-both [class*="disabled"] {
    opacity: 0.55;
}

/* ---------- graph buttons: "+" / "−" zoom next to Download (assets/graph_tools.js) ---------- */
.panel-zoom-group {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    margin-left: 0.3em;
    vertical-align: middle;
}

button.panel-action.panel-zoom {
    display: inline-grid !important;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0 !important;
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--c-primary-dark);
    background: #ffffff;
    border: 1px solid #b9dedb;
    border-radius: var(--radius-md);
    cursor: pointer;
}

button.panel-action.panel-zoom:hover {
    color: #ffffff;
    background: var(--c-primary);
    border-color: var(--c-primary);
}

/* NMA-KIT windows: Download and zoom above the graph */
.kt-graph-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4em;
    margin: 0 0 0.5em;
}

/* ---------- choice between two options (tools/ui_components.py two_way): segmented control ---------- */
/* same look everywhere: Detailed report / KIT summary, Box plot / Scatter plot, Risk of Bias / CINeMA,
   Mean / Median (effect modifiers) */
.nma-seg,
.nma-kt .kt-mod-stat {
    display: inline-flex !important;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    padding: 3px;
    background: #f6f8fa;
    border: 1px solid #dfe6ec;
    border-radius: 999px;
    vertical-align: middle;
}

.nma-seg label,
.nma-kt .kt-mod-stat label {
    display: inline-flex !important;
    align-items: center;
    margin: 0 !important;
    padding: 0.3em 0.95em !important;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: #5b6b7b;
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.nma-seg input,
.nma-kt .kt-mod-stat input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.nma-seg label:hover {
    color: #156b6c;
}

.nma-seg label:has(input:checked),
.nma-kt .kt-mod-stat label:has(input:checked) {
    color: #ffffff;
    background: #1f8a8a;
}

.nma-seg label:has(input:disabled) {
    color: #a3b0bc;
    font-weight: 500;
    cursor: not-allowed;
}

/* highlighted warning (e.g. no potential effect modifiers): stronger than the light notes */
.ui-note.nma-warning-note {
    margin: 0 0 1em;
    background: #fde8e3 !important;
    border: 1.5px solid #e8684a !important;
    border-left: 6px solid #c4473a !important;
    color: #1d2b3a;
}

.ui-note.nma-warning-note .nma-warning-icon {
    background: #c4473a !important;
    color: #ffffff !important;
    font-weight: 800;
}

.ui-note.nma-warning-note a {
    font-weight: 700;
    color: #a3352a;
}

/* =====================================================================
   Short labels and drop-downs: centred throughout (paragraphs, notes and label / value rows stay as they are)
   ===================================================================== */
/* box titles (with their number badge) */
.nma-modern .ui-card-header {
    justify-content: center;
    text-align: center;
}
/* labels above a field, and short sub-titles */
.nma-modern .ui-field-label,
.nma-modern .ui-subtitle,
.nma-modern .setup-pager-label,
.nma-modern .setup-pager-header,
.nma-modern .cinema-card-title,
.nma-modern .cinema-card-label,
.nma-modern .results-choose-title,
.nma-modern .results-downloads-title,
.nma-modern .kt-options-title,
.nma-modern .box__title,
.saveload-modal .saveload-card-title,
.saveload-modal .saveload-label {
    text-align: center;
    justify-content: center;
}
/* drop-downs: the chosen value, the placeholder, the typed text and the options */
.nma-modern .Select--single > .Select-control .Select-value,
.nma-modern .Select-placeholder,
.nma-modal .Select--single > .Select-control .Select-value,
.nma-modal .Select-placeholder {
    justify-content: center;
    text-align: center;
}
.nma-modern .Select-input,
.nma-modal .Select-input {
    text-align: center;
}
.Select-menu-outer .Select-option {
    text-align: center;
}
/* the options under a centred sub-title (e.g. effect size, outcome direction, effect modifiers) */
.nma-modern .ui-choices {
    justify-content: center;
}
