/* Agri Workforce - Bootstrap 5 Custom Styles */

:root {
    --bs-primary: #0d6efd;
    --bs-success: #198754;
    --bs-danger: #dc3545;
    --bs-warning: #ffc107;
}

body {
    background-color: #f3f5f3;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Land parcel rows are clickable: selecting one arms the map for polygon drawing. */
.parcel-row:hover {
    background-color: rgba(13, 110, 253, 0.08);
}

/* Mobile Home Background */
.mobile-home {
    background: #f8faf9 !important;
    min-height: 100vh;
    padding-bottom: 86px;
}

/* Logo/Brand Size Constraints */
.brand img,
.brand-row img {
    max-width: 60px !important;
    height: auto !important;
}

.sidebar .brand img {
    max-width: 60px !important;
    height: auto !important;
}

/* Fix Layout: Default should be desktop view */
.mobile-home {
    display: none;
}

.web-dashboard,
.sidebar,
.topbar,
.app-shell {
    display: block !important;
}

.app-shell {
    display: grid !important;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: linear-gradient(180deg, #1a4d2e 0%, #0d2818 100%);
    color: white;
    padding: 24px 16px;
    display: flex !important;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand strong {
    font-size: 18px;
}

.brand span {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: bold;
}

.user-chip {
    margin-top: auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 14px;
}

/* Farm Selector in Sidebar */
.farm-selector-sidebar {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.farm-selector-sidebar label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.farm-selector-sidebar select,
.sidebar > .form-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.farm-selector-sidebar select:hover,
.sidebar > .form-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.farm-selector-sidebar select:focus,
.sidebar > .form-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
}

.farm-selector-sidebar select option,
.sidebar > .form-select option {
    background: #1a4d2e;
    color: white;
}

/* Spacing for language selector in sidebar */
.sidebar > .form-select {
    margin-bottom: 20px;
}

/* Mobile Language Switch Styling */
.language-switch select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.language-switch select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.language-switch select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.language-switch select option {
    background: white;
    color: #111827;
}

.topbar {
    background: white;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin: -16px -16px 16px -16px;
}

.topbar h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 600;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

main {
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f3f5f3;
    min-width: 0;
    width: 100%;
    height: 100%;
}

/* Desktop Grid Layouts */
.dashboard-container {
    width: 100%;
    display: block;
}

.metric-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.metric-grid {
    margin-bottom: 14px;
}

.metric-grid > *,
.dashboard-grid > * {
    box-sizing: border-box;
    min-width: 0;
}

.panel {
    background: white;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.panel h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: #111827;
    letter-spacing: -0.01em;
}

/* Chart Panel Styles */
.panel.chart-panel {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.panel.chart-panel h2 {
    font-size: 14px !important;
    font-weight: 700;
    margin: 0 !important;
    line-height: 1.2;
    color: #111827;
}

.chart-container {
    position: relative;
    height: 180px;
    width: 100%;
    flex: 1;
}

.chart-container canvas {
    max-height: 100%;
    width: 100% !important;
    height: 100% !important;
}

.panel.wide {
    grid-column: span 2;
}

.panel.full {
    grid-column: 1 / -1;
}

/* Incident Row Styling */
.incident-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.incident-row:last-child {
    border-bottom: none;
}

.incident-row > span {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
}

.incident-row > div {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.incident-row strong {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incident-row small {
    font-size: 11px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incident-row time {
    flex-shrink: 0;
    font-size: 11px;
    color: #9ca3af;
}

.incident-row .status {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-style: normal;
    background: #fef3c7;
    color: #92400e;
}

/* Payment Row Styling */
.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.payment-row:last-child {
    border-bottom: none;
}

.payment-row span {
    font-size: 13px;
    color: #6b7280;
}

.payment-row strong {
    font-size: 15px;
    font-weight: 600;
}

.view-link {
    display: inline-block;
    margin-top: 12px;
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.view-link:hover {
    text-decoration: underline;
}

/* Activity Row Styling */
.activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.activity-row:last-child {
    border-bottom: none;
}

.activity-row > span {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
}

.activity-row p {
    flex: 1;
    margin: 0;
    font-size: 13px;
    color: #374151;
}

.activity-row time {
    flex-shrink: 0;
    font-size: 11px;
    color: #9ca3af;
}

/* Donut Chart Styling */
.donut-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
}

.donut {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(
        #10b981 0deg 259deg,
        #a855f7 259deg 334deg,
        #f59e0b 334deg 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.donut::before {
    content: '';
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: white;
}

.donut span {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.donut strong {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.donut small {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}

.donut-wrap ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.donut-wrap li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.green-dot {
    background: #10b981;
}

.purple-dot {
    background: #a855f7;
}

.orange-dot {
    background: #f59e0b;
}

/* Payroll Lines */
.payroll-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.payroll-lines p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.payroll-lines p:last-child {
    border-bottom: none;
}

.payroll-lines span {
    font-size: 13px;
    color: #6b7280;
}

.payroll-lines strong {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

/* Primary Button */
.primary-btn {
    display: inline-block;
    padding: 10px 16px;
    background: #2563eb;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #1d4ed8;
    color: white;
}

/* Section Title */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.section-title h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
}

.section-title a {
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.section-title a:hover {
    text-decoration: underline;
}

.metric-card-link {
    display: block;
    text-decoration: none;
}

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 8px 10px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 60px !important;
    max-height: 60px !important;
}

.metric-card .metric-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    font-size: 16px !important;
}

.metric-card > div {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.metric-card strong {
    font-size: 20px !important;
    font-weight: 700 !important;
    display: block !important;
    line-height: 1.1 !important;
    margin: 0 !important;
}

.metric-card p {
    font-size: 12px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    color: #111827 !important;
    line-height: 1.2 !important;
}

.metric-card small {
    font-size: 9px !important;
    color: #9ca3af !important;
    display: block !important;
    margin: 0 !important;
    line-height: 1 !important;
}

/* Mobile View - Hide desktop elements */
@media (max-width: 900px) {
    .mobile-home {
        display: block !important;
    }

    .web-dashboard,
    .sidebar,
    .topbar {
        display: none !important;
    }

    .app-shell {
        display: block !important;
        grid-template-columns: unset;
    }

    main {
        padding: 0;
    }

    /* Mobile Metric Cards - ensure visibility */
    .mobile-metrics {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        margin-top: 14px !important;
    }

    .small-metric {
        background: white !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 10px !important;
        padding: 14px !important;
        color: #111827 !important;
        display: grid !important;
        grid-template-columns: 44px 1fr !important;
        align-items: center !important;
        text-decoration: none !important;
    }

    .small-metric span {
        font-size: 30px !important;
        display: grid !important;
        place-items: center !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 8px !important;
    }

    .small-metric span svg {
        width: 24px !important;
        height: 24px !important;
        stroke-width: 2.5 !important;
        stroke: currentColor !important;
    }

    .small-metric strong {
        font-size: 24px !important;
        font-weight: 700 !important;
        color: #111827 !important;
        line-height: 1 !important;
    }

    .small-metric small {
        grid-column: 2 !important;
        color: #6b7280 !important;
        font-size: 12px !important;
        margin-top: 2px !important;
    }

    /* Metric icon colors */
    .small-metric.green span {
        background: rgba(16, 185, 129, 0.1) !important;
        color: #10b981 !important;
    }

    .small-metric.orange span {
        background: rgba(245, 158, 11, 0.1) !important;
        color: #f59e0b !important;
    }

    .small-metric.purple span {
        background: rgba(168, 85, 247, 0.1) !important;
        color: #a855f7 !important;
    }

    .small-metric.blue span {
        background: rgba(37, 99, 235, 0.1) !important;
        color: #2563eb !important;
    }

    /* Mobile card backgrounds */
    .mobile-card,
    .overview-card {
        background: white !important;
        border-radius: 12px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    }
}

/* Form field contrast - make inputs stand out against white card backgrounds */
.card .form-control,
.card .form-select,
.card textarea.form-control {
    background-color: #eef1f0;
    border-color: #d5dad8;
}

.card .form-control:focus,
.card .form-select:focus {
    background-color: #ffffff;
    border-color: #86b7fe;
}

.card .form-control:disabled,
.card .form-control[readonly] {
    background-color: #e2e6e4;
}

/* Card enhancements */
.card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15) !important;
}

/* Table hover effects */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Stat card icon backgrounds */
.bg-success.bg-opacity-10 {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.bg-primary.bg-opacity-10 {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.bg-danger.bg-opacity-10 {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* Search input styling */
.input-group-text {
    border-right: 0;
    background-color: #fff;
}

.border-start-0 {
    border-left: 0 !important;
}

.border-start-0:focus {
    border-left: 0 !important;
    box-shadow: none;
}

/* Button group sizing */
.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
}

/* Modal display fix */
.modal.fade.show.d-block {
    display: block !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1.h3 {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-direction: column;
    }

    /* Smaller stat cards for mobile - 2 columns */
    .row.g-3.mb-4 > .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Compact stat cards */
    .row.g-3.mb-4 .card-body {
        padding: 0.75rem !important;
    }

    .row.g-3.mb-4 .rounded-circle {
        padding: 0.5rem !important;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .row.g-3.mb-4 .rounded-circle i {
        font-size: 1.25rem !important;
    }

    .row.g-3.mb-4 h3 {
        font-size: 1.5rem !important;
        margin-bottom: 0 !important;
    }

    .row.g-3.mb-4 p {
        font-size: 0.7rem !important;
    }

    .row.g-3.mb-4 .flex-grow-1 {
        margin-left: 0.5rem !important;
    }

    /* Hide table on mobile, show card view instead */
    .table-responsive {
        display: none;
    }

    /* Mobile card view for workers */
    .workers-mobile-list {
        display: block;
    }

    /* Compact header on mobile */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .d-flex.justify-content-between.align-items-center > div {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .d-flex.justify-content-between.align-items-center .btn {
        flex: 1;
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    /* Hide some columns in search/filter card */
    .card-body .row.g-3 {
        gap: 0.5rem !important;
    }
}

/* Workers Table Badge Fixes */
.badge {
    font-weight: 600 !important;
    padding: 0.5em 0.85em !important;
    font-size: 0.8125rem !important;
}

/* Clickable Worker Rows */
.worker-row-clickable {
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.worker-row-clickable:hover {
    background-color: #f3f4f6 !important;
    transform: translateX(2px);
}

.worker-row-clickable:active {
    background-color: #e5e7eb !important;
}

/* Table row cursor feedback */
.table tbody tr.worker-row-clickable {
    cursor: pointer !important;
}

/* Employment Type Badge */
.badge.bg-secondary {
    background-color: #64748b !important;
    color: #ffffff !important;
}

/* Status Badges */
.badge.bg-success {
    background-color: #10b981 !important;
    color: #ffffff !important;
}

.badge.bg-danger {
    background-color: #ef4444 !important;
    color: #ffffff !important;
}

.badge.bg-warning {
    background-color: #f59e0b !important;
    color: #ffffff !important;
}

.badge.bg-warning.text-dark {
    background-color: #fbbf24 !important;
    color: #111827 !important;
}

/* Payment Method Badges */
.badge.bg-primary {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
}

/* Ensure badge icons are visible */
.badge i {
    margin-right: 0.25rem;
}

/* Modal Improvements */
.modal.fade.show.d-block {
    display: block !important;
    animation: fadeIn 0.15s ease-in;
}

/* Farm Add/Edit Modal - guarantee footer/Save button is always reachable via scroll */
#farmFormModal .modal-dialog {
    max-height: 90vh;
    margin-top: 5vh;
    margin-bottom: 5vh;
}

#farmFormModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* The form wraps header/body/footer inside .modal-content, so it must also participate in the flex column for scrolling to work */
#farmFormModal .modal-content > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 90vh;
}

#farmFormModal .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

#farmFormModal .modal-header,
#farmFormModal .modal-footer {
    flex: 0 0 auto;
}

/* Farm modal field contrast - make inputs stand out clearly against the modal background */
#farmFormModal .form-control,
#farmFormModal .form-select,
#farmFormModal textarea.form-control {
    background-color: #e9edeb;
    border-color: #b7c0bb;
}

#farmFormModal .form-control:focus,
#farmFormModal .form-select:focus {
    background-color: #ffffff;
    border-color: #86b7fe;
}

#farmFormModal .form-control:disabled,
#farmFormModal .form-control[readonly] {
    background-color: #dde3e0;
}

/* Farm View (read-only) Modal - same scroll guarantee so Edit/Close footer is always reachable */
#farmDetailModal .modal-dialog {
    max-height: 90vh;
    margin-top: 5vh;
    margin-bottom: 5vh;
}

#farmDetailModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#farmDetailModal .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    background-color: #f3f5f3;
}

#farmDetailModal .modal-header,
#farmDetailModal .modal-footer {
    flex: 0 0 auto;
}

/* Give each read-only field group a visible card-like background so values stand out */
#farmDetailModal .modal-body .row.g-3 {
    background-color: #e9edeb;
    border: 1px solid #d5dad8;
    border-radius: 6px;
    padding: 0.75rem 0.5rem;
    margin-left: 0;
    margin-right: 0;
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Delete/Remove Modal Warning Icon */
.modal-body .bi-exclamation-triangle-fill {
    color: #f59e0b !important;
    font-size: 4rem !important;
    display: inline-block;
}

.modal-header.bg-danger {
    background-color: #ef4444 !important;
}

.modal-header .bi-exclamation-triangle {
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

/* Ensure Bootstrap Icons are visible */
.bi {
    display: inline-block;
    vertical-align: middle;
}

/* Modal Button Improvements */
.modal-footer .btn {
    min-width: 100px;
}

.modal-footer .btn-danger {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
}

.modal-footer .btn-danger:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Desktop: hide mobile list */
@media (min-width: 769px) {
    .workers-mobile-list {
        display: none;
    }
}

/* Worker Photo Styling */
.worker-photo-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.worker-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.worker-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.75rem;
}

.mobile-worker-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mobile-worker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.mobile-worker-card:active {
    transform: scale(0.98);
}

/* Mobile Actions Modal */
.modal-dialog-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    max-width: 100%;
    animation: slideUpModal 0.3s ease-out;
}

.modal-dialog-bottom .modal-content {
    border-radius: 1.5rem 1.5rem 0 0 !important;
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: #dee2e6;
    border-radius: 2px;
    margin: 0 auto;
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.list-group-item-action {
    cursor: pointer;
    border: none !important;
}

.rounded-top-4 {
    border-radius: 1.5rem 1.5rem 0 0 !important;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Sidebar Navigation Icon Brightness */
.nav-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.1em;
}

.bright-icon {
    filter: brightness(1.8) contrast(1.2);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Clickable Metric Cards */
.metric-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card-link:hover {
    transform: translateY(-4px);
}

.metric-card-link:hover .metric-card {
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.metric-card-link .metric-card {
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

/* Mobile Clickable Metrics */
.small-metric {
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.small-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Blazor Error UI */
#blazor-error-ui {
    background: #dc3545;
    color: white;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: none;
    z-index: 9999;
    text-align: center;
    font-size: 0.9rem;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    margin-left: 1rem;
    cursor: pointer;
}

#blazor-error-ui .dismiss {
    margin-left: 1rem;
    cursor: pointer;
    color: white;
    text-decoration: underline;
}

/* Worker Photo in View Modal */
.worker-photo-view {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* End Date Warning Styles */
.badge.bg-danger.fw-bold {
    animation: pulse-danger 2s ease-in-out infinite;
}

@keyframes pulse-danger {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }
}

.badge.bg-warning.fw-bold {
    border: 1px solid #f59e0b;
}

.bi-exclamation-triangle-fill.text-danger {
    animation: shake 0.5s ease-in-out;
    animation-iteration-count: 3;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Settings Page - Clickable Table Rows */
.table tbody tr[style*="cursor: pointer"]:hover {
    background-color: #f8f9fa !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.table tbody tr[style*="cursor: pointer"]:active {
    background-color: #e9ecef !important;
}

/* Fix button text visibility on hover */
.btn:hover,
.btn:focus,
.btn:active,
.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-info:hover,
.btn-success:hover,
.btn-warning:hover {
    color: inherit !important;
    opacity: 1 !important;
}

.modal-footer .btn:hover,
.modal-footer .btn:focus {
    color: inherit !important;
    opacity: 1 !important;
}

/* Ensure text stays visible */
.btn:hover *,
.btn:focus *,
.btn:active * {
    color: inherit !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline !important;
}

/* Specific fixes for button content */
.modal-footer .btn-primary:hover {
    color: white !important;
}

.modal-footer .btn-secondary:hover {
    color: #212529 !important;
}

.modal-footer .btn-danger:hover {
    color: white !important;
}

.modal-footer .btn-info:hover {
    color: white !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FarmPro Dashboard Layout  (fp- namespace — overrides legacy panels)
   ═══════════════════════════════════════════════════════════════════ */

/* web-dashboard wrapper */
.web-dashboard {
    padding: 0;
    display: block;
    width: 100%;
    background: #f3f5f3;
}

/* ── Topbar / Header ── */
.fp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border-bottom: 1px solid #e4e8e5;
    gap: 12px;
}
.fp-header h1 { margin: 0; font-size: 18px; font-weight: 800; color: #0e1f16; }
.fp-header p  { margin: 2px 0 0; font-size: 12px; color: #617269; }
.fp-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.fp-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f5f3;
    border: 1px solid #dde3de;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    color: #617269;
}
.fp-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 200px;
    color: #0e1f16;
}

.fp-icon-btn {
    position: relative;
    background: #f3f5f3;
    border: 1px solid #dde3de;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
}
.fp-icon-btn em {
    position: absolute;
    top: -4px; right: -4px;
    background: #e53e3e;
    color: white;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    border-radius: 99px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}
.fp-date-btn {
    background: #f3f5f3;
    border: 1px solid #dde3de;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}
.fp-date-btn b   { font-size: 13px; font-weight: 700; color: #0e1f16; }
.fp-date-btn small { font-size: 11px; color: #617269; }

/* ── AI inline in header ── */
.fp-ai-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f3f5f3;
    border: 1px solid #dde3de;
    border-radius: 8px;
    padding: 6px 10px 6px 14px;
    max-width: 380px;
}
.fp-ai-inline-msg {
    font-size: 12px;
    color: #2d3a30;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.fp-ai-inline-btn {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Metric strip ── */
.fp-metrics {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 10px 20px;
}
.fp-metric-card {
    background: white !important;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex !important;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    text-decoration: none !important;
    color: inherit !important;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid #eef1ef;
}
.fp-metric-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.fp-metric-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.fp-metric-card strong { font-size: 20px !important; font-weight: 800; display: block !important; line-height: 1; margin-bottom: 2px; color: #0e1f16 !important; }
.fp-metric-card span   { font-size: 11px !important; font-weight: 600; color: #617269 !important; display: block !important; }
.fp-metric-card small  { font-size: 10px !important; color: #10b981 !important; display: block !important; margin-top: 1px; }

/* metric colour variants */
.fp-metric-card.fp-green  .fp-metric-icon { background: #e6f7ee; color: #229c45; }
.fp-metric-card.fp-blue   .fp-metric-icon { background: #e6f0fb; color: #2c7bd0; }
.fp-metric-card.fp-purple .fp-metric-icon { background: #f3eaf9; color: #8a44b5; }
.fp-metric-card.fp-orange .fp-metric-icon { background: #fff4e6; color: #ff8a00; }
.fp-metric-card.fp-teal   .fp-metric-icon { background: #e6f7f7; color: #008b84; }

/* ── Mini chart in panels ── */
.fp-mini-chart-wrap {
    position: relative;
    height: 180px;
    margin: 8px 0 6px;
}
.fp-mini-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Quick actions bar ── */
.fp-quick-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 20px;
    background: white;
    border-top: 1px solid #eef1ef;
    border-bottom: 1px solid #eef1ef;
    flex-wrap: wrap;
}
.fp-quick-label {
    font-size: 11px;
    font-weight: 700;
    color: #617269;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 4px;
    white-space: nowrap;
}
.fp-quick-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #f3f5f3;
    border: 1px solid #dde3de;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #0e1f16;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.fp-quick-link:hover {
    background: #d9f5df;
    border-color: #10b981;
    color: #006f37;
}
.fp-quick-link svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* ── Content grid ── */
.fp-content-grid {
    display: grid !important;
    grid-template-columns: 1.2fr 1.5fr 0.95fr;
    gap: 10px;
    padding: 0 20px 12px;
}

/* ── Shared panel ── */
.fp-panel {
    background: white !important;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    border: 1px solid #eef1ef;
    min-width: 0;
}

.fp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.fp-panel-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0e1f16;
}
.fp-panel-header a, .fp-panel-header span {
    font-size: 12px;
    font-weight: 700;
    color: #128a36;
    text-decoration: none;
    background: #d9f5df;
    border-radius: 12px;
    padding: 4px 10px;
}
.fp-panel-header a:hover { background: #c2edcc; }

/* ── Shared buttons ── */
.fp-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    background: linear-gradient(135deg, #12a64d, #00712f);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.fp-btn-primary:hover { opacity: 0.9; color: white; }
.fp-btn-full { width: 100%; justify-content: center; }

/* ── Labour panel rows ── */
.fp-rows { display: grid; gap: 7px; }
.fp-labour-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 12px; }
.fp-dot { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; margin-right: 10px; vertical-align: middle; }
.fp-dot-green { color: #229c45; } .fp-dot-red { color: #e53e3e; } .fp-dot-blue { color: #2c7bd0; }
.fp-tone-green { color: #229c45; font-weight: 700; }
.fp-tone-red   { color: #e53e3e; font-weight: 700; }
.fp-tone-blue  { color: #2c7bd0; font-weight: 700; }
.fp-tone-orange { color: #ff8a00; font-weight: 700; }
.fp-bar { grid-column: 1/2; height: 8px; background: #e3e6e5; border-radius: 99px; margin-left: 34px; }
.fp-bar span, .fp-bar-green, .fp-bar-red, .fp-bar-blue {
    display: block; height: 100%; border-radius: 99px; background: #0f9845;
}
.fp-bar .fp-bar-red   { background: #e53e3e; }
.fp-bar .fp-bar-blue  { background: #2c7bd0; }
.fp-simple-row { display: flex; justify-content: space-between; border-top: 1px solid #eef1ef; padding-top: 7px; font-size: 12px; }
.fp-btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.fp-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    background: white;
    color: #006f37;
    border: 1px solid #c5d1ca;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.fp-btn-secondary:hover { background: #f3f5f3; color: #006f37; }

/* ── Production table ── */
.fp-production-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fp-production-table th { text-align: left; color: #617269; font-size: 11px; padding: 5px 8px; border-bottom: 1px solid #eef1ef; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.fp-production-table td { padding: 7px 8px; border-top: 1px solid #eef1ef; font-weight: 600; font-size: 12px; }
.fp-production-table td:first-child { font-weight: 500; }
.fp-progress { display: inline-block; width: 80px; height: 8px; background: #e4e8e6; border-radius: 99px; margin-right: 10px; vertical-align: middle; }
.fp-progress span { display: block; height: 100%; border-radius: 99px; background: #0f9845; }
.fp-total-row td { font-weight: 900; background: #f6faf7; }

/* ── Right stack ── */
.fp-right-stack, .fp-right-stack-lower { display: grid; gap: 10px; align-content: start; }

/* ── AI card ── */
.fp-ai-msg {
    background: #f3f4f3;
    border-left: 5px solid #bee5c5;
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 10px;
    color: #2d3a30;
}
.fp-badge {
    font-style: normal;
    background: #d9f5df;
    color: #128a36;
    border-radius: 12px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

/* ── Alerts ── */
.fp-alert-icon { font-size: 16px; }
.fp-alert-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; border-top: 1px solid #edf1ef; padding: 7px 0; align-items: center; font-size: 12px; }
.fp-alert-row:first-of-type { border-top: none; padding-top: 0; }
.fp-alert-row strong, .fp-alert-row small { display: block; }
.fp-alert-row small { color: #617269; font-size: 11px; }
.fp-alert-row em    { font-style: normal; color: #9ca3af; font-size: 11px; white-space: nowrap; }

/* ── Inventory ── */
.fp-inventory-strip {
    display: flex;
    align-items: stretch;
    margin-bottom: 4px;
    border: 1px solid #e1e8e4;
    border-radius: 8px;
    overflow: hidden;
}
.fp-inventory-strip .fp-inv-card {
    flex: 1;
    border: none !important;
    border-right: 1px solid #e1e8e4 !important;
    border-radius: 0 !important;
    padding: 6px 8px !important;
    text-align: center;
    background: transparent;
    margin: 0;
}
.fp-inventory-strip .fp-inv-card:last-child { border-right: none !important; }
.fp-inventory-strip .fp-inv-icon { font-size: 18px; margin-bottom: 2px; }
.fp-inventory-strip .fp-inv-card span   { font-size: 11px; color: #617269; display: block; }
.fp-inventory-strip .fp-inv-card strong { font-size: 13px; font-weight: 700; margin: 2px 0 1px; color: #0e1f16; display: block; }
.fp-inventory-strip .fp-inv-card small  { font-size: 11px; font-weight: 600; display: block; }
/* legacy grid — kept for other pages */
.fp-inventory-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 10px; }
.fp-inv-card { border: 1px solid #e1e8e4; border-radius: 8px; padding: 10px 8px; text-align: center; }
.fp-inv-icon { font-size: 22px; margin-bottom: 4px; }
.fp-inv-card span, .fp-inv-card strong, .fp-inv-card small { display: block; }
.fp-inv-card strong { font-size: 15px; font-weight: 700; margin: 4px 0 2px; color: #0e1f16; }
.fp-inv-card small  { font-size: 11px; font-weight: 600; }
.fp-green  { color: #229c45; }
.fp-orange { color: #ff8a00; }
.fp-muted  { color: #617269; }

/* ── Finance ── */
.fp-finance-strip {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 4px;
}
.fp-finance-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
}
.fp-finance-stat span   { font-size: 11px; color: #617269; }
.fp-finance-stat strong { font-size: 15px; font-weight: 800; color: #0e1f16; }
.fp-finance-stat small  { font-size: 11px; font-weight: 600; }
.fp-finance-divider {
    width: 1px;
    height: 40px;
    background: #e1e8e4;
    flex-shrink: 0;
}
/* legacy grid — kept for other pages */
.fp-finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fp-finance-grid article { border: 1px solid #e1e8e4; border-radius: 8px; padding: 10px; }
.fp-finance-grid article span, .fp-finance-grid article strong, .fp-finance-grid article small { display: block; }
.fp-finance-grid article span   { font-size: 11px; color: #617269; margin-bottom: 3px; }
.fp-finance-grid article strong { font-size: 16px; font-weight: 800; color: #0e1f16; margin-bottom: 2px; }
.fp-finance-grid article small  { font-size: 11px; font-weight: 600; }

/* ── Weather ── */
.fp-weather-body { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.fp-weather-now  { display: flex; align-items: flex-start; gap: 10px; }
.fp-weather-emoji { font-size: 28px; line-height: 1; }
.fp-weather-now div { display: flex; flex-direction: column; gap: 2px; }
.fp-weather-now strong { font-size: 22px; font-weight: 800; color: #0e1f16; }
.fp-weather-now small  { font-size: 11px; color: #617269; }
.fp-forecast { display: flex; gap: 14px; border-left: 1px solid #e2e6e4; padding-left: 16px; }
.fp-forecast span { display: grid; gap: 6px; text-align: center; font-size: 12px; color: #617269; }
.fp-forecast b { font-weight: 800; font-size: 13px; color: #0e1f16; }

/* ── Tasks ── */
.fp-task { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin: 5px 0; cursor: pointer; font-size: 12px; }
.fp-task input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: #0f9845; }
.fp-task-normal { font-style: normal; background: #dff5df; color: #178539; border-radius: 14px; padding: 4px 12px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.fp-task-danger { font-style: normal; background: #ffdfe0; color: #db2c2c; border-radius: 14px; padding: 4px 12px; font-size: 11px; font-weight: 700; white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 1400px) {
    .fp-metrics { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 1200px) {
    .fp-content-grid { grid-template-columns: 1fr !important; }
    .fp-right-stack, .fp-right-stack-lower { grid-template-columns: 1fr 1fr !important; }
    .fp-inventory-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .fp-finance-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 900px) {
    .fp-metrics { grid-template-columns: 1fr 1fr !important; }
    .fp-header { flex-direction: column; align-items: flex-start; }
    .fp-header-right { flex-wrap: wrap; }
    .fp-ai-inline { max-width: 100%; }
    .fp-right-stack, .fp-right-stack-lower { grid-template-columns: 1fr !important; }
}

/* ── Labour nav group ──────────────────────────────────────────────── */
.nav-group { display: flex; flex-direction: column; }

.nav-group-toggle {
    all: unset;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.nav-group-toggle:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-group-toggle .nav-chevron { margin-left: auto; font-size: 12px; opacity: 0.7; }

.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding-left: 28px;
    margin-left: 16px;
    border-left: 2px solid rgba(255,255,255,0.15);
}
.nav-group.open .nav-group-items { display: flex; }

.nav-group-items a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 7px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.nav-group-items a:hover { background: rgba(255,255,255,0.08); color: white; }

/* -- Recruitment -------------------------------------------------------- */
.recruitment-links { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: 1rem; }

/* -- Light green modal -------------------------------------------------- */
.modal-agri .modal-content { background-color: #eef7ef; }
.modal-agri .modal-header,
.modal-agri .modal-footer { border-color: #cfe3d4; }
.modal-agri .form-control,
.modal-agri .form-select { background-color: #ffffff; }
.modal-agri .form-control:focus,
.modal-agri .form-select:focus { background-color: #ffffff; }

/* -- Extra-wide modal (form-heavy screens, e.g. Production activities) --- */
@media (min-width: 1400px) {
    .modal-agri-xxl { max-width: 1320px; }
}
@media (min-width: 1600px) {
    .modal-agri-xxl { max-width: 1500px; }
}
.modal-agri-xxl .form-label { white-space: nowrap; }

/* A <form> wrapping the body + footer breaks Bootstrap's scrollable flex
   layout, which pushes the footer (Save) off screen. Keep the form flexing. */
.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    max-height: 100%;
}
.modal-dialog-scrollable .modal-content > form > .modal-body { overflow-y: auto; }

/* ---------------------------------------------------------------------
   Printing
   The app shell pins the layout to the viewport (height:100vh with
   overflow:hidden on .app-shell and overflow-y:auto on <main>), so the
   browser only ever sends the visible slice to the printer. Unwind the
   scroll containers and drop the chrome so full documents print.
   --------------------------------------------------------------------- */
@media print {
    html, body {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }

    .app-shell {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        grid-template-columns: none !important;
    }

    main {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
        padding: 0 !important;
    }

    /* Chrome that must never reach the printer. */
    .sidebar,
    .topbar,
    .user-chip,
    .nav-tabs,
    .btn,
    .modal,
    .modal-backdrop,
    .d-print-none {
        display: none !important;
    }

    /* Horizontally scrolling tables clip their overflow on paper. */
    .table-responsive {
        overflow: visible !important;
    }

    table {
        width: 100% !important;
        page-break-inside: auto;
    }

    thead {
        display: table-header-group;
    }

    tr, img {
        page-break-inside: avoid;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }

    a[href]::after {
        content: "";
    }
}
