.app-menu > li.borrow-sidebar-action-item,
.app-menu .borrow-sidebar-action-item,
.borrow-sidebar-action-item {
    margin-bottom: 12px !important;
}

@media (min-width: 901px) {
    html[data-theme-style] body:not(.sidebar-collapsed) .app-sidebar .app-menu:has(.borrow-sidebar-action-item) {
        padding-right: 6px;
    }

    html[data-theme-style] body:not(.sidebar-collapsed) .app-sidebar .app-menu:has(.borrow-sidebar-action-item) > li {
        min-width: 0;
        max-width: 100%;
    }
}

.borrow-due-date--overdue {
    color: var(--color-danger-600);
    font-weight: 600;
}

.borrow-overdue-badge {
    margin-inline-start: 4px;
}

.borrow-item-card {
    position: relative;
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0;
    padding: 9px 16px 14px;
    row-gap: 9px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.borrow-policy-page {
    width: 100%;
}

.borrow-policy-page .borrow-workflow-form {
    width: 100%;
}

.borrow-policy-info-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.borrow-policy-info-grid--physical {
    grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
}

.borrow-policy-info-grid .borrow-policy-switch-field {
    min-height: 0;
    margin: 0;
}

.borrow-policy-info-grid .borrow-policy-switch-field > .catalog-switch {
    min-height: 36px;
}

@media (max-width: 900px) {
    .borrow-policy-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .borrow-policy-info-grid--physical {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .borrow-policy-info-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.borrow-item-card-header {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 0;
    color: var(--color-gray-900);
    font-size: var(--font-size-body);
    font-weight: 600;
    line-height: 18px;
}

.borrow-item-card-header .app-icon-action {
    flex: 0 0 auto;
}

.borrow-item-card .app-choice-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    accent-color: var(--color-primary-600);
}

.borrow-item-card .app-choice-option.is-checked {
    border-color: var(--color-primary-200);
    background: var(--color-primary-50);
    color: var(--color-primary-700) !important;
}

@media (max-width: 640px) {
    .borrow-item-card {
        padding: 8px 12px 12px;
    }
}

.app-menu .borrow-sidebar-action {
    position: relative;
    overflow: hidden;
    display: flex;
    width: 100%;
    min-height: 40px;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 55%, var(--color-primary-700) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3),
                0 3px 10px rgba(var(--color-primary-rgb), 0.26),
                0 1px 2px rgba(var(--color-primary-rgb), 0.16);
    font: inherit;
    font-size: var(--font-size-body);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: left;
    cursor: pointer;
    transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow .2s ease,
                background .2s ease,
                filter .2s ease;
}

/* Light sheen / sweep effect across button on hover */
.app-menu .borrow-sidebar-action::before {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.28) 50%, transparent 100%);
    transform: skewX(-20deg);
    transition: left .55s ease;
    pointer-events: none;
}

.app-menu .borrow-sidebar-action:hover::before {
    left: 140%;
}

.app-menu .borrow-sidebar-action:hover {
    color: #ffffff;
    background: linear-gradient(135deg, var(--color-primary-400) 0%, var(--color-primary-500) 55%, var(--color-primary-600) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38),
                0 6px 18px rgba(var(--color-primary-rgb), 0.38),
                0 2px 4px rgba(var(--color-primary-rgb), 0.2);
    transform: none;
}

.app-menu .borrow-sidebar-action:active {
    transform: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18),
                0 2px 6px rgba(var(--color-primary-rgb), 0.22);
    background: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-primary-800) 100%);
}

.app-menu .borrow-sidebar-action:focus-visible {
    outline: 2px solid var(--color-primary-300);
    outline-offset: 2px;
}

/* Icon badge styling */
.app-menu .borrow-sidebar-action .app-icon {
    width: 15px;
    height: 15px;
    padding: 2.5px;
    box-sizing: content-box;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: background .2s ease;
}

.app-menu .borrow-sidebar-action:hover .app-icon {
    background: rgba(255, 255, 255, 0.28);
}

/* Dark mode thắng các theme style được nạp sau module, đặc biệt là Glass. */
html.app-authenticated-page[data-color-mode="dark"] .app-menu .borrow-sidebar-action {
    background: var(--color-primary-600) !important;
    background-image: none !important;
    border-color: var(--color-primary-500) !important;
    box-shadow: inset 0 1px 0 rgba(211, 244, 239, .08), 0 3px 10px rgba(0, 0, 0, .22) !important;
    color: #ffffff !important;
}
html.app-authenticated-page[data-color-mode="dark"] .app-menu .borrow-sidebar-action:hover {
    background: var(--color-primary-500) !important;
    border-color: var(--color-primary-400) !important;
    color: #ffffff !important;
}
html.app-authenticated-page[data-color-mode="dark"] .app-menu .borrow-sidebar-action::before {
    display: none !important;
}
html.app-authenticated-page[data-color-mode="dark"] .app-menu .borrow-sidebar-action .app-icon {
    background: rgba(255, 255, 255, .14) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.borrow-workflow-form > .app-card,
.borrow-workflow-form > .borrow-workflow-advanced {
    margin-bottom: 14px;
}

.borrow-workflow-form .app-section-title {
    margin: 0 0 12px;
    color: var(--color-gray-900);
    font-size: calc(16px * var(--app-font-scale));
}

.borrow-workflow-advanced > summary {
    color: var(--color-gray-900);
    cursor: pointer;
    font-weight: 600;
}

.borrow-workflow-advanced[open] > summary {
    margin-bottom: 14px;
}

.borrow-workflow-editor {
    min-width: 0;
}

.borrow-workflow-heading,
.borrow-workflow-layout {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.borrow-workflow-heading {
    margin-bottom: 14px;
}

.borrow-workflow-heading .form-hint {
    margin: 0;
}

.borrow-workflow-layout {
    align-items: stretch;
}

.borrow-workflow-palette {
    flex: 0 0 100px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.borrow-workflow-palette h3 {
    margin: 0 0 4px;
    color: var(--color-gray-700);
    font-size: var(--font-size-body);
}

.borrow-workflow-palette button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 5px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
    color: var(--color-gray-700);
    background: var(--color-white);
    cursor: grab;
    text-align: left;
    box-shadow: 0 1px 2px rgb(16 24 40 / 5%);
    transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.borrow-workflow-palette button:hover,
.borrow-workflow-palette button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 9px rgb(16 24 40 / 10%);
}

.borrow-workflow-palette button[data-workflow-palette="2"] {
    border-color: #d6bbfb;
    background: #e9dffc;
    color: #6941c6;
}

.borrow-workflow-palette button[data-workflow-palette="2"]:hover,
.borrow-workflow-palette button[data-workflow-palette="2"]:focus-visible {
    border-color: var(--color-review-600);
    background: #ede9fe;
}

.borrow-workflow-palette button[data-workflow-palette="3"] {
    border-color: #fedf89;
    background: #ffedd5;
    color: #b54708;
}

.borrow-workflow-palette button[data-workflow-palette="3"]:hover,
.borrow-workflow-palette button[data-workflow-palette="3"]:focus-visible {
    border-color: #f79009;
    background: #fffaeb;
}

.borrow-workflow-palette button[data-workflow-palette="2"] .app-icon {
    color: var(--color-review-600);
}

.borrow-workflow-palette button[data-workflow-palette="3"] .app-icon {
    color: var(--color-warning-600);
}

.borrow-workflow-palette .app-icon {
    width: 16px;
    height: 16px;
}

.borrow-workflow-canvas {
    position: relative;
    isolation: isolate;
    flex: 1 1 460px;
    min-width: 0;
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-gray-50);
    cursor: grab;
    overscroll-behavior: contain;
}

.borrow-workflow-canvas.is-panning {
    cursor: grabbing;
    user-select: none;
}

.borrow-workflow-canvas-toolbar {
    position: static;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 2px 8px rgb(15 23 42 / 10%);
}

.borrow-workflow-canvas-toolbar .app-icon-button {
    width: 28px;
    height: 28px;
}

.borrow-workflow-zoom-value {
    min-width: 42px;
    color: var(--color-gray-700);
    font-size: var(--font-size-small);
    text-align: center;
}

.borrow-workflow-canvas-hint {
    position: absolute;
    z-index: 2;
    right: 10px;
    bottom: 8px;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-gray-600);
    background: rgb(255 255 255 / 88%);
    font-size: var(--font-size-small);
    pointer-events: none;
}

.borrow-workflow-canvas [data-workflow-paper] {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 560px;
    background: var(--color-gray-50);
    outline: 0;
    touch-action: none;
}

.borrow-workflow-inspector {
    flex: 0 0 248px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-white);
    box-shadow: 0 2px 8px rgb(16 24 40 / 5%);
}

.borrow-workflow-inspector h3 {
    margin: 0 0 14px;
    color: var(--color-gray-900);
    font-size: var(--font-size-small);
}

.borrow-workflow-inspector .app-field + .app-field,
.borrow-workflow-inspector .app-field + .app-btn {
    margin-top: 14px !important;
}

.borrow-workflow-inspector .app-field label {
    margin-bottom: 6px !important;
    line-height: 18px;
}

.borrow-workflow-inspector .app-control,
.borrow-workflow-inspector .select2-container {
    width: 100% !important;
}

.borrow-workflow-inspector [data-workflow-inspector-body] > .app-checkbox-label {
    display: flex !important;
    margin: 14px 0 0 !important;
}

.borrow-workflow-inspector .app-btn-danger {
    margin-top: 16px !important;
}

@media (max-width: 900px) {
    .borrow-workflow-layout {
        flex-direction: column;
    }

    .borrow-workflow-palette {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .borrow-workflow-palette h3 {
        flex: 0 0 100%;
    }

    .borrow-workflow-canvas {
        width: 100%;
        min-height: 300px;
    }

    .borrow-workflow-inspector {
        flex: 1 1 auto;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .borrow-workflow-heading {
        flex-direction: column;
    }

    .borrow-workflow-heading .app-row-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .borrow-workflow-canvas {
        min-height: 360px;
    }
}

/* Collapsed sidebar mode */
body.sidebar-collapsed .app-menu > li.borrow-sidebar-action-item,
body.sidebar-collapsed .borrow-sidebar-action-item {
    margin-inline: -2px;
    margin-bottom: 10px !important;
}

body.sidebar-collapsed .app-menu .borrow-sidebar-action {
    justify-content: center;
    padding-inline: 0;
    min-height: 38px;
}

body.sidebar-collapsed .borrow-sidebar-action span {
    display: none;
}

.borrow-builder-header { border: 0; padding: 0; min-width: 0; margin: 0 0 10px; }
.borrow-builder-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px; }
.borrow-builder-fields #borrow-purpose { min-height: 48px; height: 48px; resize: vertical; }
.borrow-candidate-tabs { position: static; gap: 0; padding: 0; border: 1px solid var(--color-gray-300); border-radius: var(--radius-sm); }
.borrow-candidate-tabs .app-tab { flex: 1 1 0; min-height: 32px; padding: 6px 10px; font-size: var(--font-size-body); }
.borrow-builder-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: stretch; gap: 12px; min-height: 280px; }
.borrow-builder-candidates { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.borrow-builder-candidates .app-card { margin-bottom: 0; }
.borrow-builder-candidates .app-filter-card { padding: 8px 10px; margin-bottom: 0; }
.borrow-builder-candidates > [data-borrow-candidates] { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; }
.borrow-builder-candidates > [data-borrow-candidates] > .app-card { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; }
.borrow-builder-candidates .app-table-wrap { min-height: 0; flex: 1 1 auto; }
.borrow-builder-candidates .app-table th, .borrow-builder-candidates .app-table td { padding: 6px 10px; }
.borrow-builder-cart { display: flex; min-width: 0; height: 100%; box-sizing: border-box; flex-direction: column; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--color-gray-200); border-radius: var(--radius-md); }
.borrow-builder-cart h3 { margin: 0 0 4px; font-size: var(--font-size-body); }
.borrow-builder-cart .form-hint { margin: 0 0 8px; font-size: var(--font-size-small); line-height: 16px; }
.borrow-cart-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--color-gray-200); }
.borrow-cart-item:last-child { border-bottom: 0; }
.borrow-cart-item-content { display: flex; min-width: 0; flex: 1 1 auto; flex-direction: row; align-items: center; gap: 8px; }
.borrow-cart-item-icon { flex: 0 0 auto; width: 16px; height: 16px; color: var(--color-gray-500); }
.borrow-cart-item-title { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-body); line-height: 1.4; }
.borrow-candidate-location { max-width: 240px; color: var(--color-gray-600); font-size: var(--font-size-small); overflow-wrap: anywhere; }
.borrow-candidate-conflict { display: block; margin-top: 2px; color: var(--color-warning-600, #d97706); font-size: var(--font-size-small); line-height: 16px; }
.borrow-candidate-selected-empty { margin: 0; }
.borrow-dashboard-table { min-width: 640px; }
.borrow-dashboard-status-value { stroke-width: 16; }
.borrow-dashboard-status-1 { background: var(--color-gray-400); stroke: var(--color-gray-400); }
.borrow-dashboard-status-2 { background: var(--color-warning-600); stroke: var(--color-warning-600); }
.borrow-dashboard-status-3 { background: var(--color-primary-600); stroke: var(--color-primary-600); }
.borrow-dashboard-status-4 { background: #0891b2; stroke: #0891b2; }
.borrow-dashboard-status-5 { background: var(--color-review-600); stroke: var(--color-review-600); }
.borrow-dashboard-status-6 { background: var(--color-success-600); stroke: var(--color-success-600); }
.borrow-dashboard-status-7 { background: var(--color-danger-600); stroke: var(--color-danger-600); }
.borrow-dashboard-status-8 { background: var(--color-gray-500); stroke: var(--color-gray-500); }
.borrow-dashboard-status-9 { background: var(--color-danger-600); stroke: var(--color-danger-600); }
.borrow-dashboard-status-10 { background: #d97706; stroke: #d97706; }
@media (max-width: 760px) { .borrow-builder-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .borrow-builder-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; } .borrow-builder-candidates { display: block; } .borrow-builder-candidates > [data-borrow-candidates] { display: block; } .borrow-builder-candidates > [data-borrow-candidates] > .app-card { display: block; } .borrow-builder-cart { height: auto; overflow: visible; } }
@media (max-width: 480px) { .borrow-builder-fields { grid-template-columns: minmax(0, 1fr); } }

.borrow-request-detail {
    min-width: 0;
    margin-top: 14px;
    font-size: var(--font-size-body);
    line-height: 20px;
}

body[data-current-module="Borrow"] strong {
    font-weight: 600;
}

body[data-current-module="Borrow"] .ui-dialog .ui-dialog-title {
    font-weight: 600;
}

body[data-current-module="Borrow"] .app-page-title,
body[data-current-module="Borrow"] h1,
body[data-current-module="Borrow"] h2,
body[data-current-module="Borrow"] h3,
body[data-current-module="Borrow"] h4 {
    font-weight: 600;
}

body[data-current-module="Borrow"] .borrow-request-summary-grid strong {
    font-weight: 400;
}

.borrow-request-detail.app-detail-panel {
    height: auto;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.borrow-request-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    margin-bottom: 14px;
    padding: 6px 8px;
    border: 1px solid var(--color-gray-200);
    border-radius: 12px;
    background: rgba(255, 255, 255, .88);
    box-shadow: var(--shadow-sm);
}

.borrow-request-top-row .borrow-request-tabs {
    flex: 0 0 auto;
    margin-bottom: 0;
}

.borrow-request-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
    margin-bottom: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.borrow-request-actions .app-toolbar-spacer {
    display: none;
}

.borrow-request-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
}

.borrow-request-summary .app-summary-heading {
    min-width: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-gray-200);
}

.borrow-request-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
}

.borrow-request-summary-grid > div {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    grid-template-rows: auto auto;
    min-width: 0;
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
    padding: 9px 14px;
    border-left: 1px solid var(--color-gray-200);
}

.borrow-request-summary-grid > div:first-child {
    border-left: 0;
}

.borrow-request-summary-grid > div > span:not(.borrow-request-summary-icon) {
    min-width: 0;
    color: var(--color-gray-500);
    font-size: var(--font-size-small);
    line-height: 18px;
}

.borrow-request-summary-grid strong {
    grid-column: 2;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--color-gray-900);
    font-size: var(--font-size-body);
    font-weight: 400;
    line-height: 20px;
}


.borrow-request-summary-icon {
    grid-row: 1 / -1;
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-primary-600);
    background: var(--color-primary-50);
}

.borrow-request-summary-icon .app-icon {
    width: 15px;
    height: 15px;
}

.borrow-request-tabs {
    display: flex;
    flex: 0 1 auto;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 14px;
    position: relative;
    top: auto;
    z-index: auto;
    overflow-x: auto;
    gap: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    scrollbar-width: thin;
}

.borrow-request-tabs .app-tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 9px;
    font-family: inherit;
    font-size: var(--font-size-body);
    font-weight: 600;
    line-height: 20px;
    letter-spacing: 0;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.borrow-request-tabs .app-tab .app-icon {
    display: block;
    width: 17px;
    height: 17px;
    stroke-width: 1.9;
}

.borrow-request-tabs .app-tab:hover {
    color: var(--color-primary-700);
    background: var(--color-primary-50);
}

.borrow-request-tabs .app-tab.is-active {
    color: var(--color-primary-700);
    background: var(--color-primary-50);
    border-bottom-color: transparent;
    box-shadow: none;
    font-weight: 600;
}

.borrow-request-tab-panel {
    min-width: 0;
    padding: 0;
}

.borrow-request-tab-panel > h2 {
    margin: 18px 0 10px;
    color: var(--color-gray-900);
    font-size: calc(17px * var(--app-font-scale));
    font-weight: 600;
    line-height: 24px;
    letter-spacing: -.01em;
}

.borrow-request-tab-panel > h2:first-child {
    margin-top: 16px;
}

.borrow-request-tab-panel > .app-card,
.borrow-request-tab-panel > form {
    margin-bottom: 14px;
}


.borrow-process-flow {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: none;
    min-height: 560px;
    min-width: 0;
    margin-bottom: 24px;
    padding: 28px 16px;
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background-color: #f8fbff;
    background-image: linear-gradient(#e7edf5 1px, transparent 1px), linear-gradient(90deg, #e7edf5 1px, transparent 1px);
    background-size: 24px 24px;
    cursor: grab;
    overscroll-behavior: contain;
    user-select: none;
}

.borrow-process-flow.is-panning {
    cursor: grabbing;
}

.borrow-process-flow-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.borrow-process-flow-heading h2 {
    min-width: 0;
    margin: 18px 0 10px;
    color: var(--color-gray-900);
    font-size: calc(17px * var(--app-font-scale));
    font-weight: 600;
    line-height: 24px;
    letter-spacing: -.01em;
}

.borrow-process-flow-hint {
    position: absolute;
    right: 12px;
    bottom: 8px;
    z-index: 2;
    margin: 0;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-gray-600);
    background: rgb(255 255 255 / 88%);
    font-size: var(--font-size-small);
    line-height: 16px;
    pointer-events: none;
}

.borrow-process-flow-track {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: 300px;
    transform: translate(var(--borrow-process-pan-x, 0px), var(--borrow-process-pan-y, 0px)) scale(var(--borrow-process-zoom, 1));
    transform-origin: center top;
    will-change: transform;
}

.borrow-process-flow-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(100%, 220px);
    min-height: 64px;
    padding: 13px 22px;
    border: 1.5px solid;
    border-radius: 12px;
    color: #172033;
    background: var(--color-white);
    box-shadow: 0 2px 5px rgb(15 23 42 / 12%);
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.borrow-process-flow-node.is-selected {
    outline: 2px solid var(--color-primary-600);
    outline-offset: 4px;
}

.borrow-process-flow-node:focus-visible {
    outline: 2px solid var(--color-primary-700);
    outline-offset: 4px;
}

.borrow-process-flow-node--start.is-complete {
    border-color: #2563eb;
    background: #bfd4f8;
}

.borrow-process-flow-node--start,
.borrow-process-flow-node--end {
    width: min(100%, 166px);
    border-radius: 999px;
}

.borrow-process-flow-node--approval {
    border-radius: 6px;
}

.borrow-process-flow-node--approval.is-complete {
    border-color: #7f56d9;
    background: #e9dffc;
}

.borrow-process-flow-node--end.is-complete {
    border-color: #039855;
    background: #b6efc6;
}

.borrow-process-flow-node.is-pending {
    border-color: #cbd5e1;
    color: #64748b;
    background: #f1f5f9;
    box-shadow: none;
}

.borrow-process-flow-node.is-current {
    border-color: #2563eb;
    color: #172033;
    background: #bfdbfe;
    box-shadow: 0 0 0 4px rgb(37 99 235 / 16%), 0 4px 12px rgb(37 99 235 / 15%);
}

.borrow-process-flow-node.is-rejected {
    border-color: var(--color-danger-600);
    color: #172033;
    background: #e9dffc;
    box-shadow: 0 0 0 4px rgb(220 38 38 / 12%);
}

.borrow-process-flow-node--approval.is-complete,
.borrow-process-flow-node--approval.is-pending,
.borrow-process-flow-node--approval.is-rejected {
    color: #172033;
    background: #e9dffc;
}

.borrow-process-flow-node--approval.is-pending {
    border-color: #7f56d9;
    box-shadow: 0 2px 5px rgb(15 23 42 / 12%);
}

.borrow-process-flow-node--approval.is-rejected:not(.is-current) {
    border-color: var(--color-danger-600);
}

.borrow-process-flow-node--approval.is-current {
    border-color: var(--color-primary-600);
    background: #e9dffc;
    box-shadow: 0 0 0 4px var(--color-primary-100), 0 4px 12px rgb(37 99 235 / 15%);
}

.borrow-process-flow-node-name {
    font-size: var(--font-size-body);
    font-weight: 600;
    line-height: 20px;
}

.borrow-process-flow-node-status {
    margin-top: 2px;
    color: inherit;
    font-size: var(--font-size-small);
    line-height: 16px;
}

.borrow-process-flow-node-current {
    position: absolute;
    top: -12px;
    right: 8px;
    padding: 2px 8px;
    border: 1px solid var(--color-primary-200);
    border-radius: 999px;
    color: var(--color-primary-700);
    background: var(--color-primary-50);
    font-size: calc(10px * var(--app-font-scale));
    font-weight: 600;
    line-height: 16px;
}

.borrow-process-flow-port {
    display: none;
}

.borrow-process-flow-port--top {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.borrow-process-flow-port--right {
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
}

.borrow-process-flow-port--bottom {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
}

.borrow-process-flow-port--left {
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
}

.borrow-process-flow-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 2px;
    height: 78px;
}

.borrow-process-flow-link-line {
    flex: 1;
    width: 2px;
    background: #94a3b8;
}

.borrow-process-flow-link-arrow {
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    border-top: 8px solid #64748b;
}

.borrow-process-flow-link-label {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #344054;
    background: rgb(255 255 255 / 96%);
    font-size: calc(10px * var(--app-font-scale));
    font-weight: 600;
    line-height: 14px;
    white-space: nowrap;
}

.borrow-process-flow-link.is-complete .borrow-process-flow-link-line {
    background: var(--color-success-600);
}

.borrow-process-flow-link.is-complete .borrow-process-flow-link-arrow {
    border-top-color: var(--color-success-600);
}

.borrow-process-flow-link.is-current .borrow-process-flow-link-line {
    background: linear-gradient(to bottom, var(--color-primary-600), #94a3b8);
}

.borrow-process-flow-link.is-current .borrow-process-flow-link-arrow,
.borrow-process-flow-link.is-pending .borrow-process-flow-link-arrow,
.borrow-process-flow-link.is-rejected .borrow-process-flow-link-arrow {
    border-top-color: #64748b;
}

.borrow-process-flow-link.is-rejected .borrow-process-flow-link-line {
    background: linear-gradient(to bottom, var(--color-danger-600), #94a3b8);
}

.borrow-process-flow-rejection {
    width: min(100%, 560px);
    margin: 4px 0 0;
    padding: 10px 14px;
    border: 1px solid var(--color-danger-200, #fecdca);
    border-radius: var(--radius-sm);
    color: var(--color-danger-700, #b42318);
    background: var(--color-danger-50);
    font-size: var(--font-size-small);
    line-height: 18px;
}

.borrow-process-flow-rejection strong {
    font-weight: 600;
}

.borrow-process-flow-rejection div {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.borrow-process-flow-rejection div + div {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-danger-200, #fecdca);
}

.borrow-process-step-info {
    width: 100%;
    margin-bottom: 24px;
    padding: 14px 16px;
}

.borrow-process-step-info-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}

.borrow-process-step-info-heading h3 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--color-gray-900);
    font-size: var(--font-size-body);
    font-weight: 600;
    line-height: 20px;
}

.borrow-process-step-info-heading [data-borrow-process-step-status],
.borrow-process-step-history-status {
    border: 1px solid var(--color-gray-200);
    color: var(--color-gray-700);
    background: var(--color-gray-50);
}

.borrow-process-step-status--pending,
.borrow-process-step-history-status--pending {
    border-color: var(--color-primary-100) !important;
    color: var(--color-primary-700) !important;
    background: var(--color-primary-50) !important;
}

.borrow-process-step-status--approved,
.borrow-process-step-history-status--approved {
    border-color: var(--color-success-200, #abefc6) !important;
    color: var(--color-success-700, #067647) !important;
    background: var(--color-success-50, #ecfdf3) !important;
}

.borrow-process-step-status--rejected,
.borrow-process-step-history-status--rejected {
    border-color: var(--color-danger-200, #fecdca) !important;
    color: var(--color-danger-700, #b42318) !important;
    background: var(--color-danger-50) !important;
}

.borrow-process-step-info .app-info-list dt,
.borrow-process-step-info .app-info-list dd {
    padding-block: 8px;
}

.borrow-process-step-eligible,
.borrow-process-step-history {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-gray-200);
}

.borrow-process-step-eligible h4,
.borrow-process-step-history h4 {
    margin: 0 0 8px;
    color: var(--color-gray-800);
    font-size: var(--font-size-small);
    font-weight: 600;
    line-height: 18px;
}

.borrow-process-step-eligible ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.borrow-process-step-eligible li {
    padding: 4px 9px;
    border: 1px solid var(--color-primary-100);
    border-radius: 999px;
    color: var(--color-primary-700);
    background: var(--color-primary-50);
    font-size: var(--font-size-small);
    line-height: 16px;
}

.borrow-process-step-history-list {
    display: grid;
    gap: 8px;
}

.borrow-process-step-history-item {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 4px 12px;
    padding: 9px 11px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
    color: var(--color-gray-700);
    background: var(--color-gray-50);
    font-size: var(--font-size-small);
    line-height: 17px;
}

.borrow-process-step-history-item strong {
    color: var(--color-gray-900);
    font-weight: 600;
}

.borrow-process-step-history-status {
    width: fit-content;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

.borrow-process-step-history-item span:last-child {
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
}

.borrow-process-step-details-source {
    display: none;
}

@media (max-width: 640px) {
    .borrow-request-top-row {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 8px;
    }

    .borrow-request-summary {
        align-items: flex-start;
        gap: 12px;
    }

    .borrow-request-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .borrow-request-summary-grid > div {
        padding-inline: 0;
        border-top: 1px solid var(--color-gray-200);
        border-left: 0;
    }

    .borrow-request-summary-grid > div:first-child {
        border-top: 0;
    }

    .borrow-request-tabs {
        display: flex;
        width: 100%;
    }

    .borrow-request-actions {
        width: 100%;
    }

    .borrow-request-tabs .app-tab {
        min-width: 0;
        flex: 1 1 0;
        padding-inline: 10px;
    }

    .borrow-process-flow {
        min-height: 520px;
        padding: 24px 10px;
    }

    .borrow-process-flow-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .borrow-process-flow-heading h2 {
        margin-top: 12px;
    }

    .borrow-process-flow-heading .borrow-workflow-canvas-toolbar {
        align-self: flex-end;
    }

    .borrow-process-flow-node {
        min-height: 60px;
    }

    .borrow-process-flow-link {
        height: 64px;
    }

    .borrow-process-flow-rejection {
        width: 100%;
    }

    .borrow-process-step-history-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .borrow-process-step-history-item span:last-child {
        grid-column: auto;
    }
}

@media (min-width: 641px) and (max-width: 1120px) {
    .borrow-request-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .borrow-request-summary-grid > div:nth-child(3n + 1) {
        border-left: 0;
    }
}

.borrow-request-section {
    margin-bottom: 14px;
    padding: 0;
    overflow: hidden;
}

.borrow-request-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 12px;
    border-bottom: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
}

.borrow-request-section-toggle {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    padding: 4px 6px;
    color: var(--color-gray-900);
    font-family: inherit;
    font-size: var(--font-size-body);
    line-height: 20px;
    text-align: left;
}

.borrow-request-section-toggle .app-icon {
    display: block;
}

.borrow-request-section-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.borrow-request-chevron {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    transition: transform .16s ease;
}

.borrow-request-section-toggle[aria-expanded="true"] .borrow-request-chevron {
    transform: rotate(90deg);
}

.borrow-history-card {
    width: 100%;
    overflow: hidden;
}

.borrow-history-filter {
    min-width: 190px;
    margin-left: auto;
}

.borrow-history-filter .select2-container {
    width: 220px !important;
    max-width: 100%;
}

.borrow-history-card .history-event-icon .app-icon {
    width: 11px;
    height: 11px;
    color: var(--color-white);
}

.borrow-history-card .history-table td:last-child {
    white-space: normal;
}

@media (max-width: 640px) {
    .borrow-history-filter {
        width: 100%;
    }

    .borrow-history-filter .select2-container {
        width: 100% !important;
    }
}

.borrow-request-section-body {
    display: grid;
    gap: 12px;
    padding: 12px;
}

.borrow-request-section-body > .app-card {
    margin: 0;
}

.borrow-attachment-file-picker.is-dragover .app-file-picker-label {
    border-color: var(--color-primary-600);
    background: var(--color-primary-50);
}

.app-dialog-form > .borrow-content-viewer-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    flex-basis: 0;
    padding-bottom: 16px;
}

.borrow-content-viewer-body > .pdf-viewer {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
}

.borrow-attachment-selected {
    margin-top: 8px;
}

.borrow-attachment-selected .app-file-card {
    min-width: 0;
}

.borrow-attachment-selected .app-icon-action {
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .borrow-request-section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .borrow-request-section-header > .app-btn {
        align-self: flex-start;
    }
}
