:root {
    --woodflow-primary: #2f6f44;
}

body {
    min-height: 100vh;
}

.woodflow-brand-mark {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 700;
}

.navbar-vertical .navbar-brand {
    min-height: 4rem;
}

.page-body {
    padding-top: 1.5rem;
}

.table-responsive .table {
    min-width: 760px;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

.table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.table-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-card .card-header {
    min-height: auto;
}

.modal.d-block {
    overflow-x: hidden;
    overflow-y: auto;
}

.modal-backdrop {
    z-index: 1040;
}

.modal {
    z-index: 1055;
}

.form-label.required::after {
    margin-left: 0.2rem;
    color: var(--tblr-danger);
    content: '*';
}

.metric-card .card-body {
    min-height: 7rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tblr-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 991.98px) {
    .navbar-vertical .navbar-collapse {
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
    }
}

.delivery-signature-preview {
    display: flex;
    min-height: 8rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
    background: #fff;
}

.delivery-signature-preview img {
    display: block;
    width: 100%;
    max-height: 10rem;
    object-fit: contain;
}

body.delivery-signature-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.delivery-signature-overlay {
    position: fixed;
    z-index: 20000;
    inset: 0;
    background: #0f172a;
}

.delivery-signature-shell {
    display: flex;
    width: 100%;
    height: 100dvh;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
}

.delivery-signature-toolbar {
    display: flex;
    flex: 0 0 auto;
    align-items: end;
    gap: 1rem;
}

.delivery-signature-name {
    flex: 1 1 18rem;
    max-width: 28rem;
}

.delivery-signature-actions {
    display: flex;
    margin-left: auto;
    align-items: center;
    gap: 0.5rem;
}

.delivery-signature-canvas-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    border: 2px solid #94a3b8;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.delivery-signature-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.delivery-signature-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
    color: #94a3b8;
    font-size: clamp(1.25rem, 3vw, 2.5rem);
    font-weight: 600;
    transform: translate(-50%, -50%);
    user-select: none;
}

.delivery-signature-error {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(214, 57, 57, 0.12);
    color: var(--tblr-danger);
    font-weight: 600;
}

.delivery-signature-rotate-hint {
    display: none;
}

@media (max-width: 991.98px) {
    .delivery-signature-shell {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .delivery-signature-toolbar {
        align-items: center;
    }

    .delivery-signature-toolbar > :first-child {
        min-width: 8rem;
    }

    .delivery-signature-name .form-label {
        display: none;
    }

    .delivery-signature-actions .btn {
        min-height: 2.75rem;
    }
}

@media (max-width: 991.98px) and (orientation: portrait) {
    .delivery-signature-rotate-hint {
        position: absolute;
        z-index: 3;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #0f172a;
        color: #fff;
    }
}

.activity-log-payload {
    min-width: 24rem;
    max-width: 48rem;
    white-space: normal;
    overflow-wrap: anywhere;
}


.work-order-photo-thumb {
    aspect-ratio: 4 / 3;
    width: 100%;
    object-fit: cover;
    background: var(--tblr-bg-surface-secondary, #f1f3f5);
}

.work-order-photo-link {
    display: block;
    overflow: hidden;
}

.text-prewrap {
    white-space: pre-wrap;
}

@media (display-mode: standalone) {
    body {
        overscroll-behavior-y: contain;
    }
}

.pwa-sync-message {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1090;
    max-width: min(420px, calc(100vw - 2rem));
    margin: 0;
}


/*
 * WoodFlow modal shell
 * Keep the header/footer visible and scroll only the modal body. This also
 * works when Livewire forms wrap both .modal-body and .modal-footer.
 */
.woodflow-modal .modal-dialog {
    max-height: calc(100dvh - 2rem);
}

.woodflow-modal .modal-content {
    display: flex;
    max-height: calc(100dvh - 2rem);
    flex-direction: column;
    overflow: hidden;
}

.woodflow-modal .modal-content > form {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

.woodflow-modal .modal-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.woodflow-modal .modal-header,
.woodflow-modal .modal-footer {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    background: var(--tblr-bg-surface, #fff);
}

.woodflow-modal .modal-footer {
    box-shadow: 0 -0.25rem 0.75rem rgba(31, 41, 55, 0.04);
}

@media (max-width: 767.98px) {
    .woodflow-modal .modal-dialog {
        max-height: calc(100dvh - 1rem);
        margin: 0.5rem;
    }

    .woodflow-modal .modal-content {
        max-height: calc(100dvh - 1rem);
    }
}

/*
 * Leaflet layout fallback.
 * The external Leaflet stylesheet is still loaded, but these core rules keep
 * map tiles/layers positioned correctly even when the PWA/CDN cache does not
 * return the stylesheet in time.
 */
.leaflet-container {
    position: relative;
    overflow: hidden;
    outline-offset: 1px;
    background: #ddd;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    top: 0;
    left: 0;
}

.leaflet-container img.leaflet-tile,
.leaflet-container .leaflet-marker-icon,
.leaflet-container .leaflet-marker-shadow {
    max-width: none !important;
    max-height: none !important;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    user-select: none;
    -webkit-user-drag: none;
}

.leaflet-tile {
    visibility: hidden;
}

.leaflet-tile-loaded {
    visibility: inherit;
}

.leaflet-zoom-animated {
    transform-origin: 0 0;
}

.leaflet-map-pane canvas {
    z-index: 100;
}

.leaflet-map-pane svg {
    z-index: 200;
}

.leaflet-tile-pane {
    z-index: 200;
}

.leaflet-overlay-pane {
    z-index: 400;
}

.leaflet-shadow-pane {
    z-index: 500;
}

.leaflet-marker-pane {
    z-index: 600;
}

.leaflet-tooltip-pane {
    z-index: 650;
}

.leaflet-popup-pane {
    z-index: 700;
}

.leaflet-map-pane svg,
.leaflet-map-pane canvas,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
    pointer-events: none;
}

.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
    pointer-events: auto;
}

.leaflet-control {
    position: relative;
    z-index: 800;
    pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}

.leaflet-top {
    top: 0;
}

.leaflet-right {
    right: 0;
}

.leaflet-bottom {
    bottom: 0;
}

.leaflet-left {
    left: 0;
}

.leaflet-control {
    float: left;
    clear: both;
}

.leaflet-right .leaflet-control {
    float: right;
}

.leaflet-top .leaflet-control {
    margin-top: 10px;
}

.leaflet-bottom .leaflet-control {
    margin-bottom: 10px;
}

.leaflet-left .leaflet-control {
    margin-left: 10px;
}

.leaflet-right .leaflet-control {
    margin-right: 10px;
}

.coordinate-picker-modal .modal-body {
    overflow: hidden;
}

.coordinate-picker-map {
    isolation: isolate;
    width: 100%;
    height: min(68vh, 680px);
    min-height: 420px;
    background: #e9ecef;
}

.coordinate-picker-marker {
    background: transparent !important;
    border: 0 !important;
}

.coordinate-picker-pin {
    position: relative;
    display: block;
    width: 34px;
    height: 34px;
    border: 4px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--tblr-primary, #206bc4);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    transform: rotate(-45deg);
}

.coordinate-picker-pin-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
}

.coordinate-picker-target {
    fill: var(--tblr-primary, #206bc4);
    stroke: var(--tblr-primary, #206bc4);
}

@media (max-width: 767.98px) {
    .coordinate-picker-map {
        height: 62vh;
        min-height: 360px;
    }
}

.leaflet-bar {
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.leaflet-bar a {
    display: block;
    width: 30px;
    height: 30px;
    border-bottom: 1px solid #ccc;
    background: #fff;
    color: #222;
    font-size: 18px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
}

.leaflet-bar a:first-child {
    border-radius: 4px 4px 0 0;
}

.leaflet-bar a:last-child {
    border-bottom: 0;
    border-radius: 0 0 4px 4px;
}

.leaflet-control-attribution {
    margin: 0;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-size: 11px;
}

.leaflet-control-attribution a {
    color: #0078a8;
}
