.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 16px 0;
    border-top: 1px solid #ddd;
}

/* Bootstrap classes such as .help-block set display and would otherwise override the hidden attribute. */
[hidden] {
    display: none !important;
}

/* Collapsible panels: the whole heading toggles (panel-toggle.js) and shows its state. */
.panel-heading.panel-toggle,
details > summary {
    cursor: pointer;
    user-select: none;
}

.panel-heading.panel-toggle:hover,
details > summary.panel-heading:hover {
    filter: brightness(1.15);
}

.panel-heading.panel-toggle [data-toggle="collapse"]::before,
details:not(.row-actions-menu) > summary::before {
    content: "\25B8";
    display: inline-block;
    width: 1.2em;
    text-decoration: none;
}

.panel-heading.panel-toggle.panel-toggle-open [data-toggle="collapse"]::before,
details[open]:not(.row-actions-menu) > summary::before {
    content: "\25BE";
}

details:not(.row-actions-menu) > summary {
    list-style: none;
}

details:not(.row-actions-menu) > summary::-webkit-details-marker {
    display: none;
}

[data-display-preview] {
    display: inline;
    color: inherit;
}

/* Bootstrap button groups otherwise hide inherited modal text with font-size: 0. */
.input-group-btn .modal {
    font-size: 1.5rem;
    white-space: normal;
}

[data-log-entry] {
    cursor: pointer;
}

[data-log-entry]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.log-entry-dialog {
    width: min(94vw, 1000px);
    max-height: 90vh;
    overflow: auto;
}

.log-entry-dialog::backdrop {
    background: rgba(0, 0, 0, .6);
}

.scroll-panel-dialog {
    overflow: hidden;
}

.scroll-panel-dialog[open] {
    display: flex;
    flex-direction: column;
}

.dialog-heading {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    padding-bottom: 8px;
}

.dialog-scroll-content {
    min-height: 0;
    overflow: auto;
}

.scroll-panel-dialog > .form-actions {
    flex-shrink: 0;
}

.run-details-dialog {
    width: min(94vw, 75rem);
    max-height: 90vh;
}

.modal-dialog {
    max-height: calc(100dvh - 60px);
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-height: inherit;
}

.modal-header,
.modal-footer {
    flex-shrink: 0;
}

.modal-body {
    min-height: 0;
    overflow: auto;
}

.entity-sample-dialog {
    width: min(94vw, 1400px);
    height: min(80vh, 850px);
    max-width: 96vw;
    min-width: min(420px, 94vw);
    overflow: hidden;
    resize: both;
}

.entity-sample-dialog[open] {
    display: flex;
    flex-direction: column;
}

.entity-sample-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.entity-sample-heading h2 {
    margin: 0 0 12px;
    overflow-wrap: anywhere;
}

.entity-sample-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.entity-sample-table,
.run-activity-table {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.entity-sample-table th,
.entity-sample-table td,
.run-activity-table th,
.run-activity-table td {
    overflow-wrap: anywhere;
    vertical-align: top;
}

.entity-sample-table > thead > tr > th,
.run-activity-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #4e5d6c;
    color: #fff;
    padding-right: 24px;
}

.run-activity-grid {
    max-height: min(560px, 60vh);
    overflow: auto;
    max-width: 100%;
}

.run-activity-table {
    width: 1120px;
}

.run-activity-table td:first-child {
    white-space: nowrap;
    overflow: hidden;
}

.run-activity-table a[data-open-log] {
    color: inherit;
    text-decoration: underline;
}

.run-activity-message {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.entity-sample-column-resize {
    position: absolute;
    right: 0;
    top: 0;
    width: 14px;
    height: 100%;
    padding: 0;
    border: 0;
    border-right: 2px solid #aaa;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
}

.entity-sample-column-resize:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.overview-grid {
    max-width: 100%;
    max-height: min(680px, 70vh);
    overflow: auto;
}

.overview-table {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.overview-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #4e5d6c;
    color: #fff;
    padding-right: 24px;
}

.overview-table > thead a,
.overview-grid-sort {
    color: inherit;
}

.overview-grid-sort {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    font-weight: bold;
    text-align: left;
}

.overview-table th[aria-sort="ascending"] .overview-grid-sort::after,
.overview-table th[aria-sort="ascending"] a[data-grid-sort]::after { content: " \25b2"; }
.overview-table th[aria-sort="descending"] .overview-grid-sort::after,
.overview-table th[aria-sort="descending"] a[data-grid-sort]::after { content: " \25bc"; }

.overview-grid > .overview-table > tbody > tr > td {
    overflow-wrap: anywhere;
    vertical-align: top;
    white-space: normal;
}

.overview-grid > .overview-table > tbody > tr > td.log-entry-message {
    white-space: pre-wrap;
}

.log-entry-message {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.recovery-cause {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sync-run-statistics {
    white-space: pre-line;
}

.schema-table-scroll {
    max-height: min(620px, 65vh);
    overflow: auto;
}

.schema-cards {
    min-width: 760px;
}

.user-schema-cards {
    min-width: 420px;
    table-layout: fixed;
}

.user-schema-cards > thead > tr > th:first-child {
    width: 40%;
}

.user-schema-cards > thead > tr > th:last-child {
    width: 60px;
}

.user-schema-cards input[readonly] {
    max-width: 100%;
}

.user-action-summary {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schema-column-table > tbody > tr {
    background-color: #4e5d6c;
}

.schema-column-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: dimgray;
}

.schema-column-table > thead > tr > th:last-child,
.schema-column-table > tbody > tr > td:last-child {
    position: sticky;
    right: 0;
    background-color: inherit;
    box-shadow: -2px 0 3px rgba(0, 0, 0, .2);
}

.schema-column-table > thead > tr > th:last-child {
    z-index: 2;
    background-color: dimgray;
}

.schema-column-table > tbody > tr > td:first-child {
    min-width: 160px;
    max-width: 18rem;
    overflow-wrap: anywhere;
}

@media (max-width: 767px) {
    .schema-cards,
    .user-schema-cards {
        min-width: 0;
    }

    .schema-column-table > tbody > tr > td:first-child {
        min-width: 0;
        max-width: none;
    }

    .schema-column-table > tbody > tr > td:last-child {
        position: static;
        background-color: transparent;
        box-shadow: none;
    }
}

.sync-task-create-toolbar,
.sync-task-create-toolbar > form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sync-task-create-toolbar {
    margin-bottom: 20px;
}

.sync-task-create-toolbar .btn {
    min-width: 44px;
    min-height: 44px;
}

.sync-task-create-toolbar select {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.sync-task-create-toolbar > form {
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
}

.sync-task-status {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 4px;
}

.sync-task-status,
.sync-task-status:hover,
.sync-task-status:focus {
    color: #fff;
}

.sync-task-status-success { background-color: #287d37; }
.sync-task-status-warning { background-color: #a65300; }
.sync-task-status-error { background-color: #b52b27; }
.sync-task-status-neutral { background-color: #666; }
.sync-task-status-active { background-color: #176b99; }
.sync-task-status-active::before,
.sync-busy-indicator::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.5em;
    vertical-align: middle;
    border-radius: 50%;
    background-color: currentColor;
}
.sync-task-status-active::before,
.sync-busy-indicator.active::before {
    -webkit-animation: syncwheel-pulse 1s ease-in-out infinite;
    animation: syncwheel-pulse 1s ease-in-out infinite;
}
@-webkit-keyframes syncwheel-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}
@keyframes syncwheel-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}
@media (prefers-reduced-motion: reduce) {
    .sync-task-status-active::before,
    .sync-busy-indicator.active::before { -webkit-animation: none; animation: none; }
}

.sync-task-next-run {
    display: block;
    margin-top: 4px;
}

.org-agent-create { margin-bottom: 15px; }
.org-agent-create .form-group { margin-right: 8px; }
.org-agent-token {
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
}
.org-agent-actions form:not([hidden]) {
    display: inline-block;
    margin: 0 4px 4px 0;
}
.org-agent-update-progress { margin: 4px 0; }

.form-actions > .btn {
    min-height: 44px;
}

.sync-task-tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.sync-task-tabs > li > a,
.sync-task-tabs > li > span {
    display: block;
    padding: 12px 15px;
    min-height: 44px;
}

.sync-task-tabs > li.disabled > span {
    color: #777;
    cursor: not-allowed;
}

.sync-task-tabs > li.active > span {
    border: 1px solid #ddd;
    border-bottom-color: transparent;
    border-radius: 4px 4px 0 0;
}

.row-actions {
    display: inline-flex;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
}

.row-actions-direct > a,
.row-actions-direct > button,
.row-actions-edit > a,
.row-actions-menu > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
}

.row-actions-menu > summary {
    cursor: pointer;
    list-style: none;
    font-size: 24px;
    line-height: 1;
}

.row-actions-menu > summary::-webkit-details-marker {
    display: none;
}

.row-actions-menu > summary:hover,
.row-actions-edit > a:hover {
    background: rgba(128, 128, 128, .18);
}

.row-actions-panel {
    min-width: 160px;
    width: max-content;
    max-width: min(320px, calc(100vw - 16px));
    padding: 4px;
    background: #27394b;
    color: #fff;
    border: 1px solid #75828e;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
    white-space: normal;
}

.row-actions-panel.row-actions-floating {
    position: fixed;
    z-index: 1040;
    overflow-y: auto;
}

/* Bootstrap's settled transform otherwise makes nested menus position relative to the dialog. */
.modal.in .modal-dialog:has(.row-actions-menu[open]) {
    transform: none;
}

.row-actions-panel a,
.row-actions-panel button {
    display: flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
}

.row-actions-panel a {
    color: inherit;
}

.row-actions-panel a:hover,
.row-actions-panel a:focus-visible {
    background: rgba(255, 255, 255, .16);
}

.row-actions-panel form {
    margin: 4px 8px;
}

.row-actions-confirmation {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.row-actions :focus-visible,
.row-actions-menu :focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

@media (min-width: 768px) {
    .row-actions-edit-mobile {
        display: none;
    }
}

@media (max-width: 767px) {
    .row-actions-edit {
        display: none;
    }
}

.connector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.connector-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    overflow-wrap: anywhere;
}

.connector-card > .glyphicon {
    font-size: 32px;
}

.connector-factory-name {
    min-width: 380px;
}

.prebuilt-registration .form-group {
    vertical-align: top;
    margin-right: 8px;
    margin-bottom: 8px;
}

.prebuilt-registration label {
    display: block;
}

@media (min-width: 768px) and (max-width: 991px) {
    body {
        padding-top: 0;
    }

    .navbar-fixed-top {
        position: relative;
    }

    .navbar-nav > li > a > img {
        max-width: 150px;
        height: auto;
    }

    .navbar-fixed-top #logoutForm > .navbar-right {
        margin-right: 0;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
    }

    .mobile-grid-cards {
        position: relative;
    }
}

@media (max-width: 767px) {
    body {
        padding-top: 55px;
    }

    .navbar-fixed-top .navbar-collapse {
        max-height: calc(100vh - 55px);
        overflow-y: auto;
    }

    .navbar-toggle {
        min-height: 44px;
        margin-top: 3px;
        margin-bottom: 3px;
    }

    .navbar-nav > li > a,
    .navbar-nav .dropdown-menu > li > a {
        min-height: 44px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .form-horizontal .form-group {
        margin-bottom: 16px;
    }

    .form-horizontal .control-label {
        padding-top: 0;
    }

    .form-control,
    .input-sm,
    .input-xs {
        min-height: 44px;
        max-width: 100%;
        font-size: 16px;
    }

    .connector-factory-name {
        min-width: 0;
    }

    .prebuilt-registration .form-control {
        width: 100%;
    }

    textarea.form-control {
        height: auto;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-width: 22px;
        min-height: 22px;
        vertical-align: middle;
    }

    .btn,
    .panel-heading a {
        min-height: 44px;
    }

    .panel-heading a {
        display: block;
        padding: 8px 0;
    }

    .modal-dialog {
        margin: 8px;
    }

    .modal-body {
        overflow-wrap: anywhere;
    }

    .connector-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .connector-card > a {
        min-height: 44px;
    }

    .mobile-card-table,
    .mobile-card-table > tbody,
    .mobile-grid-cards > table,
    .mobile-grid-cards > table > tbody,
    .mobile-grid-cards > table > tfoot {
        display: block;
        width: 100%;
    }

    .mobile-card-table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .mobile-card-table > tbody > tr,
    .mobile-grid-cards > table > tbody > tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid rgba(255, 255, 255, .2);
        border-radius: 6px;
        padding: 8px;
    }

    .mobile-card-table > tbody > tr > td,
    .mobile-grid-cards > table > tbody > tr > td {
        display: block;
        width: 100%;
        border: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mobile-card-table > tbody > tr > td[data-label]::before,
    .mobile-grid-cards > table > tbody > tr > td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        font-weight: bold;
    }

    .parameter-cards > tbody > tr > td:nth-child(-n+5) {
        display: none;
    }

    .parameter-cards > tbody > tr > td:nth-child(n+6)::before {
        display: block;
        margin-bottom: 4px;
        font-weight: bold;
    }

    .parameter-cards > tbody > tr > td:nth-child(6)::before { content: "Parameter"; }
    .parameter-cards > tbody > tr > td:nth-child(7)::before { content: "Description"; }
    .parameter-cards > tbody > tr > td:nth-child(8)::before { content: "Display label"; }
    .parameter-cards > tbody > tr > td:nth-child(9)::before { content: "Order"; }
    .parameter-cards > tbody > tr > td:nth-child(10)::before { content: "Encode"; }
    .parameter-cards > tbody > tr > td:nth-child(11)::before { content: "Mandatory"; }
    .parameter-cards > tbody > tr > td:nth-child(12)::before { content: "User visible"; }
    .parameter-cards > tbody > tr > td:nth-child(13)::before { content: "User read only"; }
    .parameter-cards > tbody > tr > td:nth-child(14)::before { content: "Password"; }
    .parameter-cards > tbody > tr > td:nth-child(15)::before { content: "Metadata"; }
    .parameter-cards > tbody > tr > td:nth-child(16)::before { content: "Advanced"; }
    .parameter-cards > tbody > tr > td:nth-child(17)::before { content: "Enabled"; }
    .parameter-cards > tbody > tr > td:nth-child(18)::before { content: "Value"; }

    .parameter-cards > tbody > tr > td:nth-child(n+10):nth-child(-n+17),
    .schema-cards > tbody > tr > td:nth-child(n+3):nth-child(-n+6) {
        display: inline-block;
        width: 49%;
        vertical-align: top;
    }

    .mobile-grid-cards > table > thead,
    .mobile-grid-cards > table > thead > tr {
        display: block;
    }

    .mobile-grid-cards > table > thead > tr > th:not(.sortable) {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .mobile-grid-cards > table > thead > tr > th.sortable {
        display: inline-block;
    }

    .mobile-grid-cards > table > thead > tr > th.sortable > a,
    .mobile-grid-cards > table > tfoot a {
        display: inline-block;
        min-height: 44px;
        padding: 10px 4px;
    }

    .mobile-grid-cards > table > tfoot > tr,
    .mobile-grid-cards > table > tfoot > tr > td {
        display: block;
    }

    .mobile-grid-cards > table > tbody > tr > td:last-child > a,
    .mapping-cards > tbody > tr > td:last-child > span > a,
    .schema-cards > tbody > tr > td:last-child > span > a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }
}
