/* The console's Jobs, Users, Plugins and Tokens pages (dark theme, phone-first). */
.console-page { padding-top: 16px; padding-bottom: 32px; }
.console-page-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.console-page-header h3 { margin: 0; }
.console-page-header .console-page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.console-empty { text-align: center; padding: 3em 1em; }
.console-empty h4, .console-empty h5 { margin-bottom: 1em; }
.console-search { max-width: 420px; margin-bottom: 16px; }
.console-table-scroll { width: 100%; max-width: 100%; overflow-x: auto; }
.console-table th { font-weight: 600; white-space: nowrap; }
.console-table td, .console-table th { vertical-align: middle; }
.console-table code { color: #dceaf6; }

/* Jobs. */
.jobs-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.jobs-toolbar .nav-tabs { flex: 1 1 auto; }
.jobs-toolbar-actions { margin-left: auto; padding-bottom: 6px; }
.jobs-filter { display: flex; align-items: center; gap: 8px; max-width: 560px; margin-bottom: 16px; }
.jobs-filter .form-control { flex: 1 1 auto; max-width: 420px; }
#jobs-status-filter-clear { white-space: nowrap; }
.jobs-empty { text-align: center; padding: 3em 1em; }
.jobs-empty h5 { margin-bottom: 1em; }
.job-card { margin-bottom: 16px; }
.job-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-card-status { min-width: 0; }
.job-status-line { margin: 0; overflow-wrap: anywhere; }
/* The health states in the Overview's colors (stalled amber, failing red). */
.job-status-line.job-state-stalled { color: #e0a526; }
.job-status-line.job-state-failing, .job-status-line.job-state-failed { color: #ff7b72; }
.job-title { margin-bottom: 0.5em; overflow-wrap: anywhere; }
/* A job's or a user's name, linking to its page. */
.console-name-link { color: inherit; text-decoration: none; }
.console-name-link:hover { text-decoration: underline; }
.job-card-command { white-space: pre-wrap; margin-bottom: 0.75em; }
.job-card-command code { color: #dceaf6; overflow-wrap: break-word; }
.job-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.job-actions .btn { width: 100%; }
.jobs-table td, .jobs-table th { vertical-align: middle; }
/* A short name keeps its line next to a long status (names break only past this width). */
.job-row-name { min-width: 10rem; overflow-wrap: anywhere; }
.job-row-name .job-title { font-weight: 600; margin: 0; }
.job-row-status .job-status-line { font-size: 0.95rem; }
.job-row-command { max-width: 420px; }
.job-row-command code { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #dceaf6; }
.job-row-menu-cell { width: 1%; text-align: right; }
.job-row-menu-toggle { text-decoration: none; font-size: 1.3rem; line-height: 1; padding: 4px 12px; color: var(--bs-light); }
.job-row-menu-toggle::after { display: none; }
.new-job-field { margin-bottom: 14px; }
.new-job-field > label { display: block; margin-bottom: 4px; color: #a8becf; }
.new-job-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.new-job-repeat .form-check-inline { margin-right: 1.25rem; }
.new-job-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: #17212b; color: #dceaf6; padding: 10px 12px; border-radius: 6px; margin: 0; min-height: 2.6em; }
.new-job-preview-invalid { color: #f5c26b; font-family: inherit; }

/* The login page of an instance without users: Create admin account. */
.first-admin { max-width: 520px; margin: 0 auto; }
.first-admin #first-admin-title { margin-bottom: 16px; }
.first-admin #first-admin-button { width: 100%; }

/* Users & Teams. */
.users-tabs { margin-bottom: 12px; }
.user-type-badge { font-weight: 500; }
.users-table .user-email { overflow-wrap: anywhere; }
.users-row-menu-cell { width: 1%; text-align: right; }
.user-role-default { font-weight: 500; vertical-align: 1px; }
.user-team { display: inline-block; margin-right: 10px; white-space: nowrap; }
.user-team-role { color: #a8becf; font-size: 0.85em; }
/* The Edit dialog's permissions: one box per group. */
.users-permissions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; margin: 4px 0 14px; }
.users-permissions-group { border: 1px solid #47515c; border-radius: 6px; padding: 8px 10px 4px; margin: 0; min-width: 0; }
.users-permissions-legend { float: none; width: auto; font-size: 0.85rem; font-weight: 700; color: #a8becf; margin: 0 0 4px; padding: 0; }
.users-permissions-checklist .form-check { margin-bottom: 2px; }
/* Teams: the members dialog's Add row. */
.teams-table .team-name { font-weight: 600; }
.team-members-table { margin-bottom: 10px; }
.team-members-table .custom-select { max-width: 160px; }
.team-add-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; align-items: center; }

/* Plugins. */
.plugins-tabs { margin-bottom: 16px; }
.plugins-table .plugin-provides .badge { margin: 0 4px 4px 0; font-weight: 500; }
.plugin-kind { white-space: nowrap; }
.plugin-packages-missing { color: #f5a623; }
.plugin-row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.plugin-icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 32px; }
.plugin-back-link { display: inline-block; margin: 8px 0; color: #a8becf; text-decoration: none; }
.plugin-back-link:hover, .plugin-back-link:focus-visible { color: #fff; text-decoration: none; }
.plugin-load-error { color: tomato; overflow-wrap: anywhere; }
.plugin-card-actions { margin-top: 0.5em; }

/* Tokens. */
#tokens-controls-div { align-items: center; }
.tokens-form-row { margin-bottom: 16px; }
.tokens-grant-all { margin-bottom: 12px; }
.tokens-scopes-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tokens-scopes-header .btn-link { text-decoration: none; padding: 0 4px; }
.tokens-scopes-checklist { column-count: 3; column-gap: 16px; }
.tokens-scopes-checklist .form-check { break-inside: avoid; }
.tokens-modal-id { overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
    .tokens-scopes-checklist { column-count: 2; }
}

@media (max-width: 767px) {
    #first-admin-container .form-control, #login-container .form-control { min-height: 44px; }
    .console-page { padding-left: 16px; padding-right: 16px; }
    .jobs-page .btn, .users-page .btn, .plugins-page .btn, .tokens-page .btn,
    .jobs-page .dropdown-toggle, .users-page .dropdown-toggle, .plugins-page .dropdown-toggle,
    .jobs-page .dropdown-item, .users-page .dropdown-item, .plugins-page .dropdown-item,
    .jobs-page .nav-link, .plugins-page .nav-link,
    #new-job-modal .btn, .users-modal .btn, .tokens-modal .btn { min-height: 44px; }
    .jobs-page .form-control, .users-page .form-control, .plugins-page .form-control,
    #new-job-modal .form-control, .users-modal .form-control, .tokens-modal .form-control { min-height: 44px; }
    .tokens-scopes-checklist .form-check { min-height: 44px; display: flex; align-items: center; gap: 0.5em; }
    .users-permissions-checklist .form-check, .users-modal .form-check { min-height: 44px; display: flex; align-items: center; gap: 0.5em; }
    .users-permissions-checklist .form-check .form-check-input, .users-modal .form-check .form-check-input { margin-top: 0; }
    .users-modal .custom-select, .users-modal .dash-dropdown, .users-tabs .nav-link { min-height: 44px; }
    .team-add-row { grid-template-columns: minmax(0, 1fr); }
    .tokens-scopes-checklist .form-check .form-check-input { margin-top: 0; }
    .tokens-modal .dash-datepicker-input-wrapper { min-height: 42px; }
    .tokens-modal .dash-datepicker-clear {
        display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 42px;
    }
    /* Names are links with a 44 px tap area. */
    .console-name-link { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
    /* The compact jobs table as a list: each job's name with its status under it and the ⋮
       menu beside them, so a name has the width of the row. */
    .jobs-table, .jobs-table > tbody { display: block; width: 100%; }
    .jobs-table > thead { display: none; }
    .jobs-table tr.job-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 8px;
        border-bottom: var(--bs-border-width) solid var(--bs-border-color);
    }
    .jobs-table tr.job-row > td { display: block; border-bottom-width: 0; padding: 0 4px; }
    .jobs-table tr.job-row > td.job-row-name { grid-column: 1; grid-row: 1; min-width: 0; }
    .jobs-table tr.job-row > td.job-row-status { grid-column: 1; grid-row: 2; padding-bottom: 10px; }
    .jobs-table tr.job-row > td.job-row-menu-cell { grid-column: 2; grid-row: 1 / span 2; width: auto; }
    .new-job-keys { grid-template-columns: minmax(0, 1fr); }
    .jobs-toolbar-actions { margin-left: 0; width: 100%; }
    .jobs-toolbar-actions .btn { width: 100%; }
    .console-page-header .console-page-actions .btn { flex: 1 1 auto; }
    .console-page-header .console-page-actions #tokens-refresh-button { flex: 0 0 auto; min-width: 44px; }
    .console-page-header .console-page-actions { margin-left: 0; width: 100%; }
    .console-search, .jobs-filter { max-width: none; }
    .job-row-menu-toggle { min-width: 44px; }
    .console-table td { padding-top: 0.6rem; padding-bottom: 0.6rem; }
    .users-table td { padding-top: 0; padding-bottom: 0; }
}

/* Dash 4's date picker (the token forms' Expiration) in the dark theme: dbc_dark.css styles
   Dash's dropdowns only, so its white box showed white text. */
.dbc_dark .dash-datepicker,
.dbc_dark .dash-datepicker-content {
    --Dash-Fill-Inverse-Strong: var(--bs-dark);
    --Dash-Text-Strong: #fff;
    --Dash-Text-Weak: #adb5bd;
    --Dash-Text-Disabled: #6c757d;
    --Dash-Stroke-Strong: grey;
    color: #fff;
}
.dbc_dark .dash-datepicker { border: 1px solid grey; border-radius: 4px; }
.dbc_dark .dash-datepicker-content input { color: #fff; background: transparent; }

.plugin-source-browser { margin: 24px 0; min-width: 0; }
.plugin-source-workspace {
    display: grid;
    grid-template-columns: minmax(11rem, 17rem) minmax(0, 1fr);
    border: 1px solid #47515c;
    border-radius: 8px;
    overflow: hidden;
    background: #17212b;
    color: #dceaf6;
}
.plugin-source-tree { max-height: 70vh; overflow: auto; padding: 8px 0; border-right: 1px solid #47515c; background: #131c25; }
.plugin-source-tree-list { list-style: none; padding: 0; margin: 0; }
.plugin-source-tree-list .plugin-source-tree-list { padding-left: 12px; }
.plugin-source-folder {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    cursor: pointer; font-size: 0.85rem; overflow-wrap: anywhere; list-style: none;
}
.plugin-source-folder::-webkit-details-marker { display: none; }
.plugin-source-folder .mrsm-icon { flex: 0 0 auto; color: #e5c07b; }
.plugin-source-folder:hover, .plugin-source-folder:focus-visible { background: #213449; }
.plugin-source-folder .mrsm-icon.plugin-source-folder-open, details[open] > .plugin-source-folder .mrsm-icon.plugin-source-folder-closed { display: none; }
details[open] > .plugin-source-folder .mrsm-icon.plugin-source-folder-open { display: inline-block; }
.plugin-source-file {
    display: flex; align-items: center; gap: 8px;
    width: 100%; min-height: 36px; padding: 6px 10px;
    color: #dceaf6; background: transparent; border: 0; text-align: left;
    font-family: monospace; font-size: 0.8rem;
}
.plugin-source-file:hover, .plugin-source-file:focus-visible { background: #213449; }
.plugin-source-file.active { background: #24425f; box-shadow: inset 3px 0 #85caff; }
.plugin-source-file-kind { flex: 0 0 2rem; display: inline-flex; align-items: center; color: #b9a7f5; font-size: 0.6rem; }
.plugin-source-file-kind .mrsm-icon { width: 1.1rem; height: 1.1rem; }
.plugin-source-file-kind .mrsm-icon-python { color: #6cb6ff; }
.plugin-source-file-kind .mrsm-icon-rust { color: #f0a070; }
.plugin-source-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plugin-source-content {
    min-width: 0;
    overflow: hidden;
    color: #dceaf6;
    background: #17212b;
    font-size: 0.85rem;
}
.plugin-source-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #47515c; }
.plugin-source-toolbar code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: #dceaf6; }
.plugin-source-code pre { margin: 0; padding: 12px 16px 12px 0; max-height: 65vh; overflow: auto; border: 0; background: #17212b; font-size: 0.8rem; }
.plugin-source-code pre code { display: block; color: inherit; background: transparent; counter-reset: source-line; }
/* Line numbers are generated content: never selected or copied with the code. */
.source-line { display: block; }
.source-line::before {
    counter-increment: source-line; content: counter(source-line);
    display: inline-block; box-sizing: content-box; min-width: 3ch; padding: 0 12px 0 8px; margin-right: 12px;
    border-right: 1px solid #2f3d4b; color: #6b7d8e; text-align: right; user-select: none;
}
.plugin-source-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.plugin-source-header h4 { margin: 0; }
.plugin-source-fullscreen-button, .plugin-source-copy { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 32px; }
/* `.mrsm-icon` (nav.css, loaded later) sets `display`: these rules must be more specific. */
.plugin-source-browser .mrsm-icon.plugin-source-icon-exit, .plugin-source-browser .mrsm-icon.plugin-source-icon-copied,
.plugin-source-browser.plugin-source-fullscreen .mrsm-icon.plugin-source-icon-enter,
.plugin-source-browser .plugin-source-copy.copied .mrsm-icon.plugin-source-icon-copy { display: none; }
.plugin-source-browser.plugin-source-fullscreen .mrsm-icon.plugin-source-icon-exit,
.plugin-source-browser .plugin-source-copy.copied .mrsm-icon.plugin-source-icon-copied { display: inline-block; }
.plugin-source-browser.plugin-source-fullscreen {
    position: fixed; inset: 0; z-index: 1080; margin: 0; padding: 12px 16px 16px;
    display: flex; flex-direction: column; background: #10171e;
}
.plugin-source-fullscreen .plugin-source-workspace { flex: 1; min-height: 0; }
.plugin-source-fullscreen .plugin-source-tree { max-height: none; }
/* The file's cell holds `dcc.Loading`'s wrappers around `.plugin-source-content`: every box from the
   cell down to the code fills the remaining height. */
.plugin-source-fullscreen .plugin-source-workspace div:has(.plugin-source-content),
.plugin-source-fullscreen .plugin-source-content,
.plugin-source-fullscreen .plugin-source-preview,
.plugin-source-fullscreen .plugin-source-code { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.plugin-source-fullscreen .plugin-source-code pre { max-height: none; flex: 1 1 auto; min-height: 0; }
body.plugin-source-noscroll { overflow: hidden; }
.plugin-source-code > :last-child { margin-bottom: 0; }
.source-token-keyword, .source-token-operator { color: #d7a8ff; }
.source-token-string { color: #b4d99b; }
.source-token-comment { color: #9ba8b4; font-style: italic; }
.source-token-number, .source-token-builtin { color: #efbe86; }
.source-token-function, .source-token-class, .source-token-decorator { color: #8cd3ef; }
.plugin-detail-wrapper { min-width: 0; }
.plugin-detail-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0; }
.plugin-detail-header h1 { margin-bottom: 6px; }
.plugin-detail-actions, .plugin-capabilities { display: flex; flex-wrap: wrap; gap: 8px; }
.plugin-detail-metadata { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 24px; margin-top: 24px; }
.plugin-detail-metadata h2 { font-size: 1rem; }
.plugin-detail-properties { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; }
.plugin-detail-properties dd { margin: 0; overflow-wrap: anywhere; }
.plugin-detail-description pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.plugin-detail-description p { max-width: 78ch; }
.connector-key-button { min-height: 44px; min-width: 44px; padding: 4px 0; text-align: left; max-width: 100%; }
.connector-key-button, .connector-key-button:hover, .connector-key-button:focus-visible { text-decoration: none; }
.connector-key-button:hover code, .connector-key-button:focus-visible code { color: #85caff; }
.connectors-plugin, .connectors-plugin:hover, .connectors-plugin:focus-visible { text-decoration: none; }
.connectors-plugin:hover, .connectors-plugin:focus-visible { color: #85caff; }
.connector-info-modal .modal-dialog { max-width: min(52rem, calc(100vw - 24px)); }
.connector-info-modal .modal-body { min-width: 0; overflow-wrap: anywhere; }
.connector-info-modal .connectors-attributes { max-width: 100%; }
.connector-info-summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; }
.connector-info-summary dd { margin: 0; overflow-wrap: anywhere; }
.connector-info-source { margin: 12px 0; }
.connector-inspection { margin-top: 24px; }
.connectors-fields { margin: 12px 0 6px; max-width: 36rem; font-size: 0.8rem; }
.connectors-fields dd { overflow-wrap: anywhere; }
@media (max-width: 767.98px) {
    .plugin-source-workspace { grid-template-columns: minmax(0, 1fr); }
    .plugin-source-tree { max-height: 200px; border-right: 0; border-bottom: 1px solid #47515c; }
    /* Fullscreen on a phone: the tree takes its content's height (at most 30vh, then scrolls); the file gets the rest. */
    .plugin-source-fullscreen .plugin-source-workspace { grid-template-rows: auto minmax(0, 1fr); }
    .plugin-source-fullscreen .plugin-source-tree { max-height: 30vh; }
    .plugin-source-file, .plugin-source-folder { min-height: 44px; }
    .plugin-icon-button, .plugin-source-fullscreen-button, .plugin-source-copy { min-width: 44px; min-height: 44px; }
    .plugin-back-link { display: inline-flex; align-items: center; min-height: 44px; }
    .connector-info-modal .modal-footer { gap: 8px; }
    .connector-info-modal .modal-footer .btn { min-height: 44px; }
    .connector-info-modal .modal-header .btn-close { min-width: 44px; min-height: 44px; padding: 0; }
}
