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

body {
    min-height: 100vh;
}

/* Keep the desktop application header visible while the page content scrolls. */
@media (min-width: 768px) {
    .page-wrapper > .navbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        background: var(--tblr-bg-surface, #fff);
    }
}

.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;
}

/* The same branded leaf mark is used on login and in all navigation variants. */
.woodflow-brand-logo {
    display: block;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.woodflow-brand-logo--large {
    width: 4.75rem;
    height: 4.75rem;
}

.navbar-vertical .navbar-brand > a {
    display: inline-flex;
    align-items: center;
}

.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;
}

.leaflet-popup {
    position: absolute;
    margin-bottom: 20px;
    text-align: center;
}

.leaflet-popup-content-wrapper {
    overflow: hidden;
    border: 1px solid rgba(31, 41, 55, 0.14);
    border-radius: 0.65rem;
    background: #fff;
    color: #182433;
    box-shadow: 0 0.35rem 1.25rem rgba(31, 41, 55, 0.22);
}

.leaflet-popup-content {
    min-width: 190px;
    margin: 0;
    padding: 0.8rem 0.9rem;
    color: #182433;
    line-height: 1.4;
    text-align: left;
}

.leaflet-popup-content p {
    margin: 0.5rem 0;
}

.leaflet-popup-tip-container {
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 40px;
    height: 20px;
    margin-left: -20px;
    overflow: hidden;
    pointer-events: none;
}

.leaflet-popup-tip {
    width: 17px;
    height: 17px;
    margin: -10px auto 0;
    border-right: 1px solid rgba(31, 41, 55, 0.14);
    border-bottom: 1px solid rgba(31, 41, 55, 0.14);
    background: #fff;
    box-shadow: 3px 3px 8px rgba(31, 41, 55, 0.12);
    transform: rotate(45deg);
}

.leaflet-popup-close-button {
    position: absolute;
    z-index: 2;
    top: 0.25rem;
    right: 0.35rem;
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    background: transparent;
    color: #667382;
    font-size: 1.35rem;
    line-height: 1.75rem;
    text-align: center;
    text-decoration: none;
}

.leaflet-popup-close-button:hover {
    color: #182433;
}

.woodflow-map-popup-title {
    padding-right: 1.25rem;
    color: #182433;
}

.woodflow-map-popup-meta {
    color: #667382;
}

/* Unified application connectivity indicator shown next to the signed-in user. */
.woodflow-user-summary {
    min-width: 0;
    max-width: min(58vw, 24rem);
}

.woodflow-user-name {
    min-width: 0;
    max-width: 13rem;
    font-weight: 600;
}

.woodflow-connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--tblr-secondary-color, #667382);
    white-space: nowrap;
}

.woodflow-connection-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    flex: 0 0 0.55rem;
    border-radius: 50%;
    background: var(--tblr-danger, #d63939);
    box-shadow: 0 0 0 0 rgba(214, 57, 57, 0.35);
}

.woodflow-connection-status.is-online {
    color: var(--tblr-success, #2fb344);
}

.woodflow-connection-status.is-online .woodflow-connection-dot {
    background: var(--tblr-success, #2fb344);
    animation: woodflow-online-pulse 1.6s ease-in-out infinite;
}

.woodflow-connection-status.is-offline {
    color: var(--tblr-danger, #d63939);
}

.woodflow-connection-status.is-offline .woodflow-connection-dot {
    background: var(--tblr-danger, #d63939);
    animation: none;
}

@keyframes woodflow-online-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(47, 179, 68, 0.4);
    }
    50% {
        opacity: 0.55;
        box-shadow: 0 0 0 0.28rem rgba(47, 179, 68, 0);
    }
}

@media (max-width: 575.98px) {
    .woodflow-user-summary {
        max-width: calc(100vw - 5.5rem);
    }

    .woodflow-user-name {
        max-width: min(38vw, 9rem);
    }
}

/* Global notifications stay above Bootstrap modals. */
.woodflow-toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 2000; width: min(26rem, calc(100vw - 2rem)); pointer-events: none; display: flex; flex-direction: column; gap: .75rem; }
.woodflow-toast-stack .woodflow-toast { position: relative; margin: 0; overflow: hidden; pointer-events: auto; }
.woodflow-toast-progress { position: absolute; left: 0; bottom: 0; z-index: 2; width: 100%; height: 4px; background: currentColor; opacity: .9; transform-origin: left center; transform: scaleX(1); pointer-events: none; }
.woodflow-toast.alert-success .woodflow-toast-progress { background-color: var(--tblr-success, #2fb344); }
.woodflow-toast.alert-danger .woodflow-toast-progress { background-color: var(--tblr-danger, #d63939); }
.woodflow-toast.alert-warning .woodflow-toast-progress { background-color: var(--tblr-warning, #f59f00); }
.woodflow-toast.alert-info .woodflow-toast-progress { background-color: var(--tblr-info, #4299e1); }
.woodflow-toast.is-leaving { opacity: 0; transform: translateX(1rem); transition: opacity .18s ease, transform .18s ease; }
.woodflow-toast-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; border: 1px solid currentColor; border-radius: 50%; font-size: .75rem; font-weight: 700; line-height: 1; }
@media (max-width: 575.98px) { .woodflow-toast-stack { top: .75rem; right: .75rem; width: calc(100vw - 1.5rem); } }

/* Depot colour identity */
.depot-label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}
.depot-color-dot {
    --depot-color: #206bc4;
    flex: 0 0 auto;
    width: .65rem;
    height: .65rem;
    border-radius: 999px;
    background: var(--depot-color);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--depot-color), #000 12%);
}
.stock-depot-card {
    border-width: 2px;
    border-color: var(--depot-color, var(--tblr-border-color));
}
.stock-depot-total {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--depot-color, var(--tblr-body-color));
}
.stock-depot-products {
    display: grid;
    gap: .55rem;
}
.stock-depot-product {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-top: .55rem;
    border-top: 1px solid var(--tblr-border-color);
}
.stock-depot-product:first-child {
    padding-top: 0;
    border-top: 0;
}
.nav-submenu .nav-link {
    padding-left: 2.8rem;
}

/* Keep the offline-readiness menu inside the mobile viewport. */
.woodflow-offline-dropdown-menu {
    min-width: 280px;
    max-width: calc(100vw - 1rem);
}

@media (max-width: 767.98px) {
    .woodflow-offline-dropdown {
        position: static;
    }

    .woodflow-offline-dropdown-menu {
        right: 0.5rem !important;
        left: 0.5rem !important;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: calc(100dvh - 6rem);
        overflow-y: auto;
        transform: none !important;
    }
}

@media (min-width: 1400px) {
    .container-xxl {
        max-width: none;
    }
}
