/* ==========================================================================
   FleetModern.css — Phase A global UI polish (additive only; safe overrides)
   ========================================================================== */

:root {
    --fm-font: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fm-primary: #0047AB;
    --fm-primary-dark: #003892;
    --fm-surface: #ffffff;
    --fm-border: #e2e8f0;
    --fm-muted: #64748b;
    --fm-text: #0f172a;
    --fm-radius: 12px;
    --fm-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
    --fm-focus-ring: 0 0 0 3px rgba(0, 71, 171, 0.22);
}

/* ── Typography ─────────────────────────────────────────────────────────── */
.fms-layout,
.main-content,
.dashboard-content,
.modal-card,
.k-window-content {
    font-family: var(--fm-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page-title {
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--fm-text);
}

.field-label,
.form-label-modern {
    font-weight: 500;
    font-size: 12.5px;
    color: #334155;
}

/* ── Cards & page shells ─────────────────────────────────────────────────── */
.main-content .card {
    border: 1px solid var(--fm-border);
    border-radius: var(--fm-radius);
    box-shadow: var(--fm-shadow);
}

.main-content .card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--fm-border);
}

/* Report pages nest .card-body inside .card-header — avoid a full-page grey slab */
.main-content .report-page .card,
.main-content .report-page .card-header,
.main-content .report-page .card-body {
    background: #ffffff !important;
}

.main-content .report-page .card-header {
    border-bottom: none !important;
}

.main-content .report-page .je-filters-section {
    background: #ffffff !important;
    border: 1px solid var(--fm-border) !important;
    border-radius: var(--fm-radius) !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    padding: 16px 20px !important;
}

.main-content .report-page .je-filters-section > .row,
.main-content .report-page .je-filters-section .row {
    gap: 10px 12px !important;
}

.main-content .report-page .je-filters-section .row > .je-filter-actions-col,
.main-content .report-page .je-filters-section .row > [class*="col-"]:has(#btnShow),
.main-content .report-page .je-filters-section .row > [class*="col-"]:has(#searchbtn) {
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.main-content .report-page .je-filters-section .je-filter-actions,
.main-content .report-page .je-filters-section .form-group.je-filter-actions,
.main-content .report-page .je-filters-section .form-group[style*="margin-top:22px"] {
    margin-top: 0 !important;
    margin-left: 0 !important;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary-modern.fm-is-saving,
.btn-primary-modern:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary-modern:focus-visible,
.btn-secondary-modern:focus-visible,
.form-control-modern:focus-visible {
    outline: none;
    box-shadow: var(--fm-focus-ring);
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    backdrop-filter: blur(2px);
}

.modal-card {
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
    background: #ffffff;
}

.modal-header {
    border-bottom: none !important;
    background: #0047AB !important;
    border-radius: 0 !important; /* parent .modal-card clips rounded corners */
    padding: 18px 28px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    gap: 12px !important;
    color: #ffffff !important;
    margin: 0 !important;
}

.modal-header h5,
.modal-header h3,
.modal-header h4,
.modal-header .modal-title {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    flex: 1 !important;
    text-align: left !important;
}

.modal-header .modal-close-btn,
.modal-header .close {
    color: rgba(255, 255, 255, 0.9) !important;
}

.modal-header .modal-close-btn:hover,
.modal-header .close:hover {
    color: #ffffff !important;
}

.modal-close-btn:focus-visible {
    outline: none;
    box-shadow: var(--fm-focus-ring);
    border-radius: 6px;
}

/* ── Kendo grids ───────────────────────────────────────────────────────── */
.k-grid {
    border-radius: var(--fm-radius);
    border-color: var(--fm-border) !important;
    overflow: hidden;
}

.k-grid-header th.k-header {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    border-color: var(--fm-border) !important;
}

.k-grid .k-grid-header th.k-amount-col,
.k-grid .k-grid-header th[style*="text-align:right"],
.k-grid .k-grid-header th[style*="text-align: right"] {
    text-align: right !important;
}

.k-grid .k-grid-header th.k-amount-col > .k-link,
.k-grid .k-grid-header th[style*="text-align:right"] > .k-link,
.k-grid .k-grid-header th[style*="text-align: right"] > .k-link {
    display: flex !important;
    justify-content: flex-end !important;
    text-align: right !important;
    width: 100% !important;
    margin: 0 !important;
}

.k-grid .k-grid-header th.k-amount-col .k-column-title,
.k-grid .k-grid-header th[style*="text-align:right"] .k-column-title,
.k-grid .k-grid-header th[style*="text-align: right"] .k-column-title {
    text-align: right !important;
    width: 100% !important;
    display: block !important;
}

.k-grid td {
    border-color: #f1f5f9 !important;
}

.k-grid tr.k-alt {
    background-color: #fafbfc !important;
}

.k-grid tr.k-state-selected,
.k-grid tr.k-state-selected:hover {
    background-color: #e8f0fb !important;
}

.k-grid .k-grid-content tr:hover:not(.k-grouping-row) {
    background-color: #f1f5f9 !important;
}

.k-grid-norecords {
    padding: 2.5rem 1rem !important;
}

.k-grid-norecords-template {
    color: var(--fm-muted);
    font-size: 13px;
    font-weight: 500;
}

.k-pager-wrap {
    border-top: 1px solid var(--fm-border);
    background: #fafbfc;
}

/* Grid loading overlay */
.k-loading-mask {
    background: rgba(255, 255, 255, 0.75) !important;
}

.k-loading-color {
    background: transparent !important;
}

/* ── Kendo windows (dashboard popups, etc.) ──────────────────────────────── */
.k-window {
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2) !important;
}

.k-window-titlebar,
.k-window .k-window-titlebar,
.k-window-titlebar.k-header {
    background: linear-gradient(135deg, var(--fm-primary) 0%, var(--fm-primary-dark) 100%) !important;
    background-color: var(--fm-primary) !important;
    background-image: none !important;
    color: #ffffff !important;
    border: none !important;
}

.k-window-title {
    color: #ffffff !important;
    font-weight: 600 !important;
}

.k-window-titlebar .k-window-action,
.k-window-titlebar .k-icon,
.k-window-titlebar .k-font-icon,
.k-window-titlebar [class*="k-i-close"] {
    color: #ffffff !important;
}

/* ── Form inputs ─────────────────────────────────────────────────────────── */
.form-control-modern,
.input-group-addon {
    border-color: #cbd5e1 !important;
}

.form-control-modern:hover {
    border-color: #94a3b8 !important;
}

.form-control-modern:focus {
    border-color: var(--fm-primary) !important;
}

/* ── Filter / report sections ────────────────────────────────────────────── */
.je-filters-section,
.je-grid-section {
    border-radius: var(--fm-radius);
}

.page-header-row {
    margin-bottom: 0.75rem;
}

/* ── Empty state utility (optional markup) ───────────────────────────────── */
.fm-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--fm-muted);
}

.fm-empty-state i {
    font-size: 2rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    display: block;
}

.fm-empty-state p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}

/* ── Toastr polish ───────────────────────────────────────────────────────── */
#toast-container > div {
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15) !important;
    opacity: 0.98 !important;
}

/* ── Accessibility: skip decorative motion if requested ──────────────────── */
@media (prefers-reduced-motion: reduce) {
    .btn-primary-modern,
    .modal-overlay,
    .k-window {
        transition: none !important;
    }
}

/* ==========================================================================
   Phase B — legacy page modernization (additive; no markup required)
   ========================================================================== */

/* Map legacy Bootstrap action buttons to modern look inside page shells */
.main-content .page-actions .btn.btn-info,
.main-content .page-header-row .btn.btn-info,
.main-content .card .page-actions .btn.btn-info {
    background: linear-gradient(135deg, var(--fm-primary), #1a5fc4) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(0, 71, 171, 0.28) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.main-content .page-actions .btn.btn-info:hover,
.main-content .page-header-row .btn.btn-info:hover,
.main-content .card .page-actions .btn.btn-info:hover {
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 71, 171, 0.35) !important;
}

.main-content .btn.btn-success#btnAddUpdate,
.main-content .panel-body .btn.btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

/* Soften legacy white-box / panel shells */
.main-content .white-box {
    background: #fff !important;
    border: 1px solid var(--fm-border) !important;
    border-radius: var(--fm-radius) !important;
    box-shadow: var(--fm-shadow) !important;
    padding: 20px !important;
    margin-bottom: 16px !important;
}

.main-content .panel.panel-info {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin-bottom: 0 !important;
}

.main-content .panel.panel-info > .panel-heading {
    background: linear-gradient(180deg, #f1f5f9 0%, #e8eef5 100%) !important;
    color: var(--fm-text) !important;
    border: 1px solid var(--fm-border) !important;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    padding: 12px 16px !important;
}

.main-content .panel.panel-info > .panel-body {
    border: 1px solid var(--fm-border) !important;
    border-top: none !important;
    border-radius: 0 0 10px 10px !important;
    padding: 16px !important;
    background: #fff !important;
}

.main-content .form-control:not(.form-control-modern) {
    border-radius: 8px !important;
    border-color: #cbd5e1 !important;
    min-height: 40px !important;
}

/* ── Page header (Phase C extract — overrides after layout) ─────────────── */
.page-header-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    padding: 8px 0 14px !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid var(--fm-border) !important;
}

.page-title {
    font-family: var(--fm-font) !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: var(--fm-text) !important;
    letter-spacing: -0.02em !important;
}

.report-page .page-title {
    font-size: 1.625rem !important;
}

.page-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
}

.ap-bank-total {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    background: #eef4ff;
    border: 1px solid #c9daf8;
    color: #0047AB;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.btn-primary-modern {
    background: #0047AB !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(0, 71, 171, 0.28) !important;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease !important;
}

.btn-primary-modern:hover,
.btn-primary-modern:focus {
    background: #003892 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 71, 171, 0.35) !important;
}

.btn-secondary-modern {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: 600 !important;
}

/* ── JE header (form/workflow pages) ─────────────────────────────────────── */
.je-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    margin-bottom: 20px !important;
    padding: 18px 24px !important;
    border-bottom: none !important;
    border-radius: var(--fm-radius) !important;
    background: linear-gradient(135deg, var(--fm-primary) 0%, var(--fm-primary-dark) 100%) !important;
    box-shadow: 0 2px 8px rgba(0, 71, 171, 0.2) !important;
}

.je-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    min-width: 0 !important;
}

.je-header-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
    flex-shrink: 0 !important;
}

.je-header-icon i {
    color: #fff !important;
}

.je-header-title {
    margin: 0 !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
    color: #fff !important;
}

.je-header-subtitle {
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: rgba(255, 255, 255, 0.82) !important;
    margin-top: 3px !important;
}

.je-header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

/* ── Grid & filter sections (Phase C extract) ────────────────────────────── */
.je-grid-section {
    background: #f8fafc !important;
    border: 1px solid var(--fm-border) !important;
    border-radius: var(--fm-radius) !important;
    overflow: hidden !important;
    margin-bottom: 20px !important;
}

.je-grid-body {
    background: #fff !important;
}

.je-filters-section {
    background: #fff !important;
    border: 1px solid var(--fm-border) !important;
    border-radius: var(--fm-radius) !important;
    padding: 20px 22px !important;
    margin-bottom: 18px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    align-items: flex-end !important;
}

.je-filters-section .form-group {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

.je-filters-actions {
    margin-left: 0 !important;
    flex: 0 0 auto !important;
    align-self: flex-end !important;
}

.je-filters-section .je-label,
.je-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    word-spacing: 0.22em !important;
    margin-bottom: 6px !important;
    display: inline-flex !important;
    align-items: baseline !important;
    flex-wrap: nowrap !important;
    gap: 0.28em !important;
    white-space: nowrap !important;
}

/* Nested MVC LabelFor inside .je-label stays on the same line as the asterisk */
.je-filters-section .je-label > label,
.je-label > label {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    text-transform: inherit !important;
    letter-spacing: inherit !important;
    line-height: inherit !important;
}

.je-filters-section .required,
.je-label .required,
.je-label .fa-asterisk,
span.required,
.required-asterisk,
.required-indicator,
.form-group .fa-asterisk,
.field-label .fa-asterisk,
.modal-body .fa-asterisk {
    color: #ef4444 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    margin-left: 0 !important;
    display: inline-block !important;
    vertical-align: 0.08em !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
}

.report-page .je-filters-section .row > [class*="col-"] {
    margin-bottom: 12px !important;
}

/* ── Modal system reinforcements (Phase C extract) ───────────────────────── */
.modal-overlay.open {
    display: flex !important;
}

.modal-card.modal-sm {
    max-width: 520px !important;
    height: auto !important;
    max-height: 90vh !important;
}

.modal-footer {
    border-top: 1px solid var(--fm-border) !important;
    padding: 14px 20px !important;
    background: #fafbfc !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}

/* ── Inspection image gallery modal ─────────────────────────────────────── */
#imagesModal.fms-images-modal.in,
#imagesModal.fms-images-modal.show {
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
}

#imagesModal.fms-images-modal .modal-dialog {
    width: min(960px, 94vw);
    max-width: 960px;
    margin: 3.5vh auto;
}

#imagesModal.fms-images-modal .modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

#imagesModal.fms-images-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(180deg, #0047AB 0%, #003892 100%);
    border-bottom: none;
    color: #fff;
}

#imagesModal.fms-images-modal .modal-header .modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

#imagesModal.fms-images-modal .modal-header .fms-images-meta {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.85;
    margin-left: 8px;
}

#imagesModal.fms-images-modal .modal-header .close {
    margin: 0;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 30px;
    border-radius: 8px;
    opacity: 1;
    color: #fff;
    text-shadow: none;
    background: rgba(255, 255, 255, 0.12);
}

#imagesModal.fms-images-modal .modal-header .close:hover {
    background: rgba(255, 255, 255, 0.22);
}

#imagesModal.fms-images-modal .modal-body {
    max-height: min(72vh, 640px);
    overflow-y: auto;
    padding: 18px 20px 12px;
    background: #f1f5f9;
}

#imagesModal.fms-images-modal .fms-images-hint {
    margin: 0 0 12px;
    font-size: 11.5px;
    color: #64748b;
}

#imagesModal.fms-images-modal #imageContainer,
#imagesModal.fms-images-modal .fms-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    width: 100%;
    margin: 0;
}

#imagesModal.fms-images-modal .image-container {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
    float: none;
}

#imagesModal.fms-images-modal .insp-image-card {
    position: relative;
    width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    min-height: 160px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

#imagesModal.fms-images-modal .insp-image-card:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

#imagesModal.fms-images-modal .insp-image-card img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    cursor: zoom-in;
    background: #e2e8f0;
}

#imagesModal.fms-images-modal .insp-image-card.is-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 12px;
    text-align: center;
    padding: 24px 12px;
    min-height: 180px;
    background: #f8fafc;
}

#imagesModal.fms-images-modal .insp-image-delete {
    z-index: 5;
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    line-height: 1;
    padding: 0;
    opacity: 0.92;
}

#imagesModal.fms-images-modal .insp-image-delete:hover {
    background: #b91c1c;
    opacity: 1;
}

#imagesModal.fms-images-modal .insp-image-delete i {
    font-size: 12px;
    pointer-events: none;
}

#imagesModal.fms-images-modal .fms-images-empty,
#imagesModal.fms-images-modal .fms-images-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 16px;
    color: #64748b;
    font-size: 13px;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

#imagesModal.fms-images-modal .fms-images-loading i {
    display: block;
    font-size: 22px;
    margin-bottom: 10px;
    color: #0047AB;
}

#imagesModal.fms-images-modal .modal-footer {
    background: #fff !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 12px 20px !important;
}

#imagesModal.fms-images-modal .modal-footer .btn {
    min-width: 96px;
    border-radius: 8px;
    font-weight: 500;
}

@media (max-width: 576px) {
    #imagesModal.fms-images-modal .modal-dialog {
        width: 96vw;
        margin: 2vh auto;
    }

    #imagesModal.fms-images-modal #imageContainer,
    #imagesModal.fms-images-modal .fms-image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    #imagesModal.fms-images-modal .insp-image-card img {
        height: 140px;
    }
}

.form-section .section-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    margin: 0 0 14px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

/* ── Car Maintenance step wizard (Phase B — visual only) ─────────────────── */
.fm-step-wizard {
    display: flex !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 12px 20px 16px !important;
    background: #f8fafc !important;
    border-bottom: 1px solid var(--fm-border) !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.fm-step-wizard .fm-step {
    flex: 1 1 0 !important;
    min-width: 100px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
    position: relative !important;
    padding: 0 8px !important;
    color: var(--fm-muted) !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-align: center !important;
    transition: color 0.2s ease !important;
}

.fm-step-wizard .fm-step:not(:last-child)::after {
    content: '' !important;
    position: absolute !important;
    top: 14px !important;
    left: calc(50% + 18px) !important;
    width: calc(100% - 36px) !important;
    height: 2px !important;
    background: #e2e8f0 !important;
    z-index: 0 !important;
}

.fm-step-wizard .fm-step.active:not(:last-child)::after,
.fm-step-wizard .fm-step.done:not(:last-child)::after {
    background: var(--fm-primary) !important;
}

.fm-step-wizard .fm-step-num {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: #e2e8f0 !important;
    color: #64748b !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    position: relative !important;
    z-index: 1 !important;
    transition: background 0.2s ease, color 0.2s ease !important;
}

.fm-step-wizard .fm-step.active .fm-step-num,
.fm-step-wizard .fm-step.done .fm-step-num {
    background: var(--fm-primary) !important;
    color: #fff !important;
}

.fm-step-wizard .fm-step.active {
    color: var(--fm-primary) !important;
}

.fm-step-wizard .fm-step-label {
    line-height: 1.2 !important;
    max-width: 90px !important;
}

/* ==========================================================================
   Phase C — mobile responsive pass (top workflows)
   ========================================================================== */

@media (max-width: 991px) {
    .page-header-row {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .page-actions {
        width: 100% !important;
    }

    .page-actions .btn,
    .page-actions button {
        flex: 1 1 auto !important;
        min-width: 120px !important;
    }

    .je-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .je-header-actions {
        width: 100% !important;
    }

    .je-filters-section .row > [class*="col-"],
    .je-filters-section > .form-group {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .modal-card {
        width: 96vw !important;
        max-width: 96vw !important;
        height: 94vh !important;
        max-height: 94vh !important;
        border-radius: 12px !important;
    }

    /* Keep Kendo grids as desktop tables; swipe sideways to see all columns. */
    .k-grid {
        font-size: 12px !important;
        overflow: hidden !important;
        max-width: 100% !important;
    }

    .k-grid .k-grid-header,
    .k-grid .k-grid-header-wrap,
    .k-grid table thead,
    .k-grid table colgroup {
        display: revert !important;
    }

    .k-grid .k-grid-header-wrap,
    .k-grid .k-grid-footer-wrap {
        overflow: hidden !important;
    }

    .k-grid .k-grid-content,
    .k-grid-content {
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-x: contain;
    }

    .k-grid .k-grid-header table,
    .k-grid .k-grid-content table,
    .k-grid .k-grid-footer table,
    .k-grid table {
        display: table !important;
        width: max-content !important;
        min-width: 100% !important;
        max-width: none !important;
        table-layout: auto !important;
    }

    .k-grid table thead { display: table-header-group !important; }
    .k-grid table tbody { display: table-row-group !important; }
    .k-grid table colgroup { display: table-column-group !important; }

    .k-grid .k-grid-content tr,
    .k-grid .k-grid-header tr,
    .k-grid table tr {
        display: table-row !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        animation: none !important;
        overflow: visible !important;
        width: auto !important;
        max-width: none !important;
    }

    .k-grid .k-grid-content td,
    .k-grid .k-grid-header th,
    .k-grid table th,
    .k-grid table td {
        display: table-cell !important;
        width: auto !important;
        max-width: none !important;
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
        vertical-align: middle !important;
    }

    .k-grid .k-grid-content td::before,
    .k-grid td span[data-label]::before {
        content: none !important;
        display: none !important;
    }

    .k-grid .k-grid-content td:has(button),
    .k-grid .k-grid-content td:has(.btn) {
        display: table-cell !important;
    }

    .k-widget.k-window:has(.dash-popup-body),
    body > .k-window:has(.dash-popup-body),
    .k-window:has(.dash-popup-body) {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        height: auto !important;
        max-height: calc(100vh - 16px) !important;
        max-height: calc(100dvh - 16px) !important;
        left: 8px !important;
        top: 8px !important;
        right: 8px !important;
        border-radius: 12px !important;
    }

    .k-window:has(.dash-popup-body) > .k-window-content {
        width: 100% !important;
        height: auto !important;
        max-height: calc(100vh - 72px) !important;
        max-height: calc(100dvh - 72px) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    .k-window:has(#ChangePasswordWindow),
    .k-window:has(.cp-window) {
        width: min(480px, calc(100vw - 24px)) !important;
        max-width: min(480px, calc(100vw - 24px)) !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        right: auto !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        border-radius: 12px !important;
    }

    #ChangePasswordWindow.k-window-content {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .k-window .dash-popup-body,
    .k-window #dvOngoingDevelopmentWork {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Single table + wrapper swipe: header stays over cells. */
    .k-window table,
    .k-window table.dataTable,
    .k-window table.table-striped {
        display: table !important;
        width: max-content !important;
        min-width: 720px !important;
        max-width: none !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    .k-window table thead,
    .k-window table.dataTable thead {
        display: table-header-group !important;
    }

    .k-window table tbody,
    .k-window table.dataTable tbody {
        display: table-row-group !important;
    }

    .k-window table tr,
    .k-window table.dataTable tr,
    .k-window table.table-striped tr {
        display: table-row !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
        width: auto !important;
        max-width: none !important;
    }

    .k-window table th,
    .k-window table td,
    .k-window table.dataTable th,
    .k-window table.dataTable td,
    .k-window table.table-striped th,
    .k-window table.table-striped td {
        display: table-cell !important;
        width: auto !important;
        min-width: 88px !important;
        max-width: none !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
        float: none !important;
        background-image: none !important;
        overflow: visible !important;
    }

    .k-window table td::before,
    .k-window table.dataTable td::before {
        content: none !important;
        display: none !important;
    }

    .k-window .dataTables_wrapper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .k-window .dataTables_scroll,
    .k-window .dataTables_scrollHead,
    .k-window .dataTables_scrollFoot,
    .k-window .dataTables_scrollBody {
        overflow: visible !important;
        width: max-content !important;
        min-width: 100% !important;
    }

    .k-window .dataTables_filter,
    .k-window .dataTables_info,
    .k-window .dataTables_paginate,
    .k-window .dataTables_length {
        float: none !important;
        width: 100% !important;
        text-align: left !important;
        margin: 0 0 10px !important;
    }

    .k-window .dataTables_filter label {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .k-window .dataTables_filter input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 42px !important;
        font-size: 16px !important;
    }

    .k-window .dataTables_paginate {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        padding-top: 8px !important;
    }

    .k-window table.dataTable.dtr-inline.collapsed > tbody > tr > td.child,
    .k-window table.dataTable tr.child,
    .k-window table.dataTable td.child,
    .k-window table.dataTable td.dtr-control {
        display: none !important;
    }

    .fm-step-wizard .fm-step {
        min-width: 80px !important;
        font-size: 9px !important;
    }

    .fm-step-wizard .fm-step-label {
        max-width: 72px !important;
    }
}

/* ── Inline workflow editors (complex forms kept on-page) ───────────────── */
.fm-inline-editor {
    background: #fff !important;
    border: 1px solid var(--fm-border) !important;
    border-radius: var(--fm-radius) !important;
    box-shadow: var(--fm-shadow) !important;
    padding: 20px 22px !important;
    margin-bottom: 18px !important;
}

.fm-workflow-page .je-label,
.fm-inline-editor .je-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #475569 !important;
}

@media (max-width: 575px) {
    .main-content .card-body {
        padding: 12px !important;
    }

    .page-title {
        font-size: 1.25rem !important;
    }

    .je-filters-section {
        padding: 14px 16px !important;
    }

    .modal-footer {
        flex-direction: column-reverse !important;
    }

    .modal-footer .btn {
        width: 100% !important;
    }

    .white-box {
        padding: 14px !important;
    }
}

/* Launch / hub pages with primary actions */
.fm-action-launch .btn-lg {
    min-width: 180px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
}

/* Report/toolbar Print buttons — match secondary modern (ids/handlers unchanged) */
.page-actions .btn.btn-warning,
.report-page .page-actions .btn.btn-warning,
.je-header .btn.btn-warning {
    border: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    transform: none !important;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease !important;
    position: relative;
    z-index: 1;
}

.page-actions .btn.btn-warning:hover,
.page-actions .btn.btn-warning:focus,
.page-actions .btn.btn-warning:active,
.report-page .page-actions .btn.btn-warning:hover,
.report-page .page-actions .btn.btn-warning:focus,
.report-page .page-actions .btn.btn-warning:active,
.je-header .btn.btn-warning:hover,
.je-header .btn.btn-warning:focus,
.je-header .btn.btn-warning:active {
    border: 1px solid #94a3b8 !important;
    background: #e2e8f0 !important;
    color: #0f172a !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
    outline: none !important;
}

/* Clickable dashboard KPI cards — keyboard focus ring */
.dash-stat-card.clickable:focus-visible {
    outline: none;
    box-shadow: var(--fm-focus-ring), var(--fm-shadow);
}

/* ── HMS-style paste / drop / browse upload zone (FMS navy brand) ─────── */
.fms-paste-zone {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 0 8px;
    padding: 14px 16px;
    border: 1.5px dashed #93b4e0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f7faff 0%, #eef4fb 100%);
    cursor: pointer;
    outline: none;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .12s ease;
    user-select: none;
    min-height: 76px;
    box-sizing: border-box;
    width: 100%;
}
.fms-paste-zone:hover,
.fms-paste-zone:focus,
.fms-paste-zone.is-active {
    border-color: var(--fm-primary, #0047AB);
    border-style: solid;
    background: linear-gradient(180deg, #eef4fb 0%, #e3ecf8 100%);
    box-shadow: 0 0 0 3px rgba(0, 71, 171, .14);
}
.fms-paste-zone.is-dragover {
    border-color: #15803d;
    border-style: solid;
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .16);
    transform: scale(1.004);
}
.fms-paste-zone.is-uploading {
    pointer-events: none;
    border-style: solid;
    border-color: #6b9bd1;
    background: #eef4fb;
}
.fms-paste-zone.is-uploading .fms-paste-zone__hint,
.fms-paste-zone.is-uploading .fms-paste-zone__action { display: none; }
.fms-paste-zone.is-disabled {
    opacity: .55;
    pointer-events: none;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #cbd5e1;
    border-style: dashed;
    box-shadow: none;
}
.fms-paste-zone__icon {
    width: 46px; height: 46px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    border: 1px solid #c5d6ee;
    color: var(--fm-primary, #0047AB);
    font-size: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.fms-paste-zone.is-dragover .fms-paste-zone__icon {
    background: #dcfce7; border-color: #86efac; color: #15803d;
}
.fms-paste-zone.is-uploading .fms-paste-zone__icon {
    background: #e3ecf8; border-color: #93b4e0; color: var(--fm-primary, #0047AB);
}
.fms-paste-zone__body { flex: 1; min-width: 0; }
.fms-paste-zone__title {
    font-weight: 600; font-size: 12.5px; color: #0f172a; margin: 0 0 4px;
    letter-spacing: .01em;
    line-height: 1.3;
}
.fms-paste-zone__hint {
    margin: 0;
    font-size: 11px;
    color: #64748b;
    line-height: 1.45;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}
.fms-paste-zone__step {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.fms-paste-zone__sep { color: #94a3b8; font-weight: 600; }
.fms-paste-zone__status {
    display: none;
    margin: 0;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--fm-primary, #0047AB);
}
.fms-paste-zone.is-uploading .fms-paste-zone__status { display: block; }
.fms-paste-zone__kbd {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid #cbd5e1;
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #fff;
    font-size: 10px;
    font-weight: 600;
    font-family: Consolas, "Courier New", Monaco, monospace;
    color: #334155;
    line-height: 1.2;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.fms-paste-zone__action {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #c5d6ee;
    color: var(--fm-primary, #0047AB);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.fms-paste-zone:hover .fms-paste-zone__action,
.fms-paste-zone:focus .fms-paste-zone__action,
.fms-paste-zone.is-active .fms-paste-zone__action {
    background: var(--fm-primary, #0047AB);
    border-color: var(--fm-primary, #0047AB);
    color: #fff;
}
.fms-paste-zone--kendo,
.fms-paste-zone--plain { margin-bottom: 10px; }

/* Compact paste strip under each Kendo Upload (avoids stacking full cards) */
.fms-kendo-upload { margin-bottom: 0; }
.fms-kendo-paste-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 12px;
    padding: 9px 12px;
    border: 1px dashed #93b4e0;
    border-radius: 10px;
    background: linear-gradient(180deg, #fafcff 0%, #f3f7fc 100%);
    cursor: pointer;
    outline: none;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    user-select: none;
    box-sizing: border-box;
    width: 100%;
}
.fms-kendo-paste-hint:hover,
.fms-kendo-paste-hint:focus,
.fms-kendo-paste-hint.is-active {
    border-color: var(--fm-primary, #0047AB);
    border-style: solid;
    background: #eef4fb;
    box-shadow: 0 0 0 3px rgba(0, 71, 171, .12);
}
.fms-kendo-paste-hint.is-dragover {
    border-color: #15803d;
    border-style: solid;
    background: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .14);
}
.fms-kendo-paste-hint.is-uploading {
    pointer-events: none;
    border-style: solid;
    border-color: #6b9bd1;
    background: #eef4fb;
}
.fms-kendo-paste-hint.is-uploading .fms-kendo-paste-hint__text { display: none; }
.fms-kendo-paste-hint__icon {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    border: 1px solid #c5d6ee;
    color: var(--fm-primary, #0047AB);
    font-size: 12px;
}
.fms-kendo-paste-hint.is-dragover .fms-kendo-paste-hint__icon {
    background: #dcfce7; border-color: #86efac; color: #15803d;
}
.fms-kendo-paste-hint__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    font-size: 11.5px;
    color: #334155;
    line-height: 1.35;
}
.fms-kendo-paste-hint__text strong {
    font-weight: 600;
    color: #0f172a;
}
.fms-kendo-paste-hint__keys {
    color: #64748b;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.fms-kendo-paste-hint__keys kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid #cbd5e1;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #fff;
    font-size: 9.5px;
    font-weight: 600;
    font-family: Consolas, "Courier New", Monaco, monospace;
    color: #334155;
}
.fms-kendo-paste-hint__status {
    display: none;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--fm-primary, #0047AB);
}
.fms-kendo-paste-hint.is-uploading .fms-kendo-paste-hint__status { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 640px) {
    .fms-paste-zone { flex-wrap: wrap; gap: 10px; }
    .fms-paste-zone__action { width: 100%; justify-content: center; }
    .fms-kendo-paste-hint__text { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ── Image lightbox + document preview popup ───────────────────────────── */
.fms-image-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 32000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.fms-image-lightbox.is-open { display: flex; }
body.fms-lightbox-open { overflow: hidden; }
.fms-image-lightbox__backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.88);
    cursor: zoom-out;
}
.fms-image-lightbox__panel {
    position: relative; z-index: 1;
    max-width: min(94vw, 1280px);
    max-height: 94vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.fms-image-lightbox__close {
    position: absolute; top: -44px; right: 0;
    width: 36px; height: 36px; border: none; border-radius: 50%;
    background: rgba(255, 255, 255, 0.95); color: #1e293b;
    font-size: 24px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.fms-image-lightbox__img {
    display: block; max-width: 100%; max-height: calc(94vh - 40px);
    object-fit: contain; border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45); background: #fff;
}
.fms-image-lightbox__caption {
    margin-top: 12px; color: rgba(255, 255, 255, 0.9);
    font-size: 13px; text-align: center;
}

.fms-document-preview {
    display: none;
    position: fixed; inset: 0; z-index: 32100;
    align-items: center; justify-content: center;
    padding: 24px; box-sizing: border-box;
}
.fms-document-preview.is-open { display: flex; }
.fms-document-preview__backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.88); cursor: pointer;
}
.fms-document-preview__panel {
    position: relative; z-index: 1;
    width: min(96vw, 1100px); height: min(92vh, 860px);
    background: #fff; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    display: flex; flex-direction: column; overflow: hidden;
}
.fms-document-preview__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0; background: #f8fafc; flex-shrink: 0;
}
.fms-document-preview__title {
    font-size: 14px; font-weight: 600; color: #0f172a;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fms-document-preview__actions { display: flex; align-items: center; gap: 8px; }
.fms-document-preview__open-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 8px;
    background: #e8f0fb; color: #0047AB;
    font-size: 11px; font-weight: 600; text-decoration: none;
}
.fms-document-preview__close {
    width: 34px; height: 34px; border: none; border-radius: 50%;
    background: #e2e8f0; color: #1e293b; font-size: 22px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.fms-document-preview__body {
    flex: 1; min-height: 0; position: relative; background: #525659;
}
.fms-document-preview__frame {
    width: 100%; height: 100%; border: 0; display: block; background: #fff;
}
.fms-document-preview__fallback {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 28px; text-align: center;
    color: #e2e8f0; background: #0f172a;
}
.fms-document-preview__fallback-icon {
    width: 64px; height: 64px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
    font-size: 28px; color: #93c5fd; margin-bottom: 4px;
}
.fms-document-preview__fallback-title {
    margin: 0; font-size: 14px; font-weight: 600; color: #fff;
}
.fms-document-preview__fallback-text {
    margin: 0 0 8px; max-width: 420px; font-size: 12px; line-height: 1.5; color: #94a3b8;
}
.fms-document-preview__fallback-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: 10px;
    background: #0047AB; color: #fff !important;
    font-size: 12px; font-weight: 600; text-decoration: none !important;
}
.fms-document-preview__fallback-btn:hover { background: #003892; color: #fff !important; }

/* ==========================================================================
   ERP-style busy / loading overlays (grids + edit fetch)
   ========================================================================== */

body.fm-busy-open {
    overflow: hidden;
}

.fm-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 20050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.fm-busy-overlay.is-visible {
    display: flex;
}

.fm-busy-dialog {
    box-sizing: border-box;
    width: min(360px, 92vw);
    padding: 28px 30px 24px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 16px 40px rgba(15, 23, 42, 0.16);
    text-align: center;
    animation: fm-busy-in 0.2s ease-out;
}

@keyframes fm-busy-in {
    from { opacity: 0; transform: translateY(6px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fm-busy-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid #e8eef8;
    border-top-color: var(--fm-primary, #0047AB);
    animation: fm-busy-spin 0.7s linear infinite;
}

.fm-busy-title {
    margin: 0 0 6px;
    font-family: var(--fm-font);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--fm-text, #0f172a);
    line-height: 1.3;
}

.fm-busy-sub {
    margin: 0;
    font-family: var(--fm-font);
    font-size: 12px;
    line-height: 1.45;
    color: var(--fm-muted, #64748b);
}

@keyframes fm-busy-spin {
    to { transform: rotate(360deg); }
}

/* Modal edit loading — local panel (never a second full-page blocker) */
.modal-overlay.is-loading .modal-body {
    pointer-events: none;
    opacity: 0.45;
}

.modal-overlay.is-loading .modal-footer {
    pointer-events: none;
    opacity: 0.55;
}

.modal-overlay.is-loading .modal-card {
    position: relative;
}

.modal-overlay.is-loading .fm-modal-busy {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 40;
    pointer-events: none;
    max-width: calc(100% - 32px);
}

.modal-overlay.is-loading .fm-modal-busy .fm-busy-dialog {
    width: min(320px, 100%);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 32px rgba(15, 23, 42, 0.14);
}

.modal-overlay.is-loading .modal-card::after {
    content: none;
}

/* Kendo GRID / LISTVIEW loading only — do not restyle dropdown/combo masks */
.k-grid > .k-loading-mask,
.k-grid .k-loading-mask,
.k-listview > .k-loading-mask,
.k-listview .k-loading-mask {
    background: rgba(248, 250, 252, 0.82) !important;
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

.k-grid .k-loading-color,
.k-listview .k-loading-color {
    background: transparent !important;
    opacity: 1 !important;
}

.k-grid .k-loading-mask .k-loading-image,
.k-listview .k-loading-mask .k-loading-image {
    opacity: 0 !important;
    visibility: hidden !important;
    background-image: none !important;
}

.k-grid .k-loading-mask .fm-busy-panel,
.k-listview .k-loading-mask .fm-busy-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    box-sizing: border-box;
    width: min(240px, calc(100% - 24px));
    padding: 16px 18px 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    text-align: center;
    pointer-events: none;
}

.k-grid .k-loading-mask .fm-busy-panel .fm-busy-spinner,
.k-listview .k-loading-mask .fm-busy-panel .fm-busy-spinner {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    border-width: 2.5px;
}

.k-grid .k-loading-mask .fm-busy-panel .fm-busy-title,
.k-listview .k-loading-mask .fm-busy-panel .fm-busy-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.k-grid .k-loading-mask .fm-busy-panel .fm-busy-sub,
.k-listview .k-loading-mask .fm-busy-panel .fm-busy-sub {
    font-size: 11px;
}

.k-grid .k-loading-text,
.k-listview .k-loading-text {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .fm-busy-dialog,
    .fm-busy-spinner,
    .k-grid .k-loading-mask .fm-busy-panel .fm-busy-spinner,
    .k-listview .k-loading-mask .fm-busy-panel .fm-busy-spinner {
        animation: none !important;
    }

    .fm-busy-spinner,
    .k-grid .k-loading-mask .fm-busy-panel .fm-busy-spinner,
    .k-listview .k-loading-mask .fm-busy-panel .fm-busy-spinner {
        border-top-color: var(--fm-primary, #0047AB);
        opacity: 0.85;
    }
}


