:root {
    --green: #0d3b2e;
    --green2: #164f3d;
    --green3: #e7f0ec;
    --ink: #18221f;
    --muted: #6c7773;
    --line: #dde4e1;
    --bg: #f4f6f5;
    --white: #fff;
    --danger: #b42318;
    --warning: #8a5b00;
    --shadow: 0 8px 30px rgba(19,50,40,.08);
    font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    color: var(--ink)
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    font-size: 15px
}

a {
    color: var(--green);
    text-decoration: none
}

button, input, select, textarea {
    font: inherit
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 245px;
    background: var(--green);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    z-index: 10
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: inherit
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--green);
    font-weight: 900
}

.brand strong, .brand small {
    display: block
}

.brand small {
    opacity: .68;
    margin-top: 2px
}

.desktop-nav {
    display: grid;
    gap: 6px;
    margin-top: 36px
}

.nav-link {
    color: #dceae5;
    padding: 12px 13px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    font-weight: 650
}

    .nav-link:hover {
        background: rgba(255,255,255,.09);
        color: #fff
    }

.sidebar-user {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.13);
    padding-top: 16px;
    display: grid;
    gap: 8px;
    font-size: 13px
}

.text-button {
    padding: 0;
    background: none;
    border: 0;
    color: #bcd1ca;
    cursor: pointer
}

.main {
    margin-left: 245px;
    padding: 28px;
    max-width: 1700px
}

.mobile-header, .mobile-nav {
    display: none
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px
}

    .page-head h1, .delivery-hero h1 {
        margin: 3px 0 4px;
        font-size: 30px;
        line-height: 1.1
    }

    .page-head p, .delivery-hero p {
        margin: 0;
        color: var(--muted)
    }

.eyebrow {
    font-size: 11px;
    letter-spacing: .12em;
    font-weight: 850;
    color: #60736c
}

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px
}

    .panel-head h2, .form-section h2 {
        margin: 0 0 4px
    }

    .panel-head p, .form-section p {
        margin: 0;
        color: var(--muted)
    }

.btn {
    border: 0;
    border-radius: 9px;
    padding: 10px 14px;
    font-weight: 750;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center
}

    .btn.primary {
        background: var(--green);
        color: #fff
    }

    .btn.ghost {
        border: 1px solid var(--line);
        background: #fff;
        color: var(--ink)
    }

    .btn.full {
        width: 100%
    }

    .btn.compact {
        padding: 7px 10px
    }

.kpis {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 16px;
    margin-bottom: 20px
}

.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 5px;
    color: inherit
}

    .kpi > span {
        color: var(--muted);
        font-size: 13px
    }

    .kpi strong {
        font-size: 28px
    }

    .kpi small {
        color: var(--muted)
    }

.delivery-kpi {
    background: var(--green);
    color: #fff
}

    .delivery-kpi > span, .delivery-kpi small {
        color: #d9e7e2
    }

.mini-deliveries {
    display: grid;
    gap: 8px
}

.mini-delivery {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: inherit
}

    .mini-delivery > div {
        display: grid;
        gap: 3px
    }

    .mini-delivery small {
        color: var(--muted)
    }

.date-chip {
    font-size: 11px;
    font-weight: 800;
    color: var(--green)
}

.status, .delivery-status {
    display: inline-flex;
    border-radius: 999px;
    background: #eef2f0;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800
}

    .status.loaded, .delivery-status.loaded {
        background: #e5eefb;
        color: #234b87
    }

    .status.ready, .delivery-status.ready {
        background: #fff2ce;
        color: #795300
    }

    .status.delivered, .delivery-status.delivered {
        background: #ddf5e8;
        color: #17663c
    }

.table-wrap {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px
}

th {
    text-align: left;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    padding: 10px 11px;
    border-bottom: 1px solid var(--line)
}

td {
    padding: 12px 11px;
    border-bottom: 1px solid #edf0ef;
    vertical-align: middle
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px
}

    .toolbar input {
        flex: 1
    }

    .toolbar input, .toolbar select, input, select, textarea {
        border: 1px solid #cfd8d4;
        border-radius: 9px;
        padding: 10px 11px;
        background: #fff;
        min-width: 0
    }

.mobile-order-list {
    display: none
}

.form-grid.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px
}

.section-title {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    margin-bottom: 18px
}

    .section-title > span {
        width: 29px;
        height: 29px;
        border-radius: 50%;
        background: var(--green);
        color: #fff;
        display: grid;
        place-items: center;
        font-size: 12px;
        font-weight: 850
    }

.fields {
    display: grid;
    gap: 12px
}

    .fields.two {
        grid-template-columns: 1fr 1fr
    }

    .fields.three {
        grid-template-columns: repeat(3,1fr)
    }

label {
    display: grid;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
    color: #42514c
}

.span-2 {
    grid-column: span 2
}

.check {
    display: flex;
    align-items: center;
    gap: 8px
}

    .check input {
        width: auto
    }

.line-item {
    display: grid;
    grid-template-columns: 32px 90px minmax(240px,1fr) 130px 38px;
    gap: 10px;
    align-items: end;
    padding: 10px 0;
    border-bottom: 1px solid #edf0ef
}

.line-no {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #eef3f1;
    display: grid;
    place-items: center;
    font-weight: 850;
    margin-bottom: 2px
}

.line-item .remove {
    width: 36px;
    height: 40px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    font-size: 19px
}

.add-line {
    margin-top: 12px;
    background: #edf4f1;
    color: var(--green)
}

.totals-card {
    align-self: start
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #edf0ef
}

    .total-row.editable input {
        width: 120px;
        text-align: right
    }

    .total-row.grand {
        font-size: 19px
    }

    .total-row.balance {
        color: var(--green)
    }

.balance-due {
    color: var(--danger) !important
}

.validation {
    color: var(--danger);
    margin-bottom: 12px
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px
}

.details {
    margin: 0
}

    .details > div {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        padding: 11px 0;
        border-bottom: 1px solid #edf0ef
    }

    .details dt {
        color: var(--muted)
    }

    .details dd {
        margin: 0;
        text-align: right
    }

.delivery-note {
    margin-top: 14px;
    border-left: 4px solid #c9932e;
    background: #fff7e8;
    padding: 12px;
    border-radius: 7px
}

.audit-row {
    display: flex;
    gap: 18px;
    border-top: 1px solid #edf0ef;
    padding: 12px 0
}

    .audit-row > span {
        min-width: 100px;
        color: var(--muted);
        font-size: 12px
    }

    .audit-row div {
        display: grid
    }

    .audit-row small {
        color: var(--muted);
        margin-top: 3px
    }

.delivery-hero {
    display: flex;
    justify-content: space-between;
    align-items: end
}

.date-picker label {
    display: grid;
    gap: 6px
}

.delivery-tabs {
    display: flex;
    gap: 7px;
    margin: 0 0 18px
}

    .delivery-tabs a {
        padding: 9px 14px;
        border-radius: 999px;
        background: #e8eeeb;
        color: #40504a;
        font-weight: 800
    }

        .delivery-tabs a.active {
            background: var(--green);
            color: #fff
        }

.load-summary {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 10px
}

.load-item {
    display: flex;
    gap: 11px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px
}

.load-qty {
    min-width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--green);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 900
}

.load-item div {
    display: grid
}

.load-item small {
    color: var(--muted);
    margin-top: 2px
}

.delivery-summary-strip {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 10px;
    margin-bottom: 18px
}

    .delivery-summary-strip > div {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 11px;
        padding: 12px;
        display: flex;
        justify-content: space-between;
        align-items: center
    }

    .delivery-summary-strip span {
        color: var(--muted);
        font-size: 12px
    }

    .delivery-summary-strip strong {
        font-size: 17px
    }

.delivery-date-group {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 26px 0 10px;
    padding-bottom: 9px;
    border-bottom: 2px solid var(--green)
}

    .delivery-date-group > span {
        background: var(--green);
        color: #fff;
        padding: 7px 10px;
        border-radius: 7px;
        font-size: 11px;
        font-weight: 900;
        letter-spacing: .08em
    }

    .delivery-date-group div {
        display: grid
    }

    .delivery-date-group small {
        color: var(--muted)
    }

.delivery-list {
    display: grid;
    gap: 13px
}

.delivery-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow)
}

    .delivery-card.loaded {
        border-color: #9cb4d6
    }

    .delivery-card.delivered {
        opacity: .78
    }

.delivery-date-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #eff4f2;
    border-bottom: 1px solid var(--line);
    padding: 8px 14px
}

    .delivery-date-strip span {
        font-size: 10px;
        letter-spacing: .1em;
        font-weight: 900;
        color: #677873
    }

    .delivery-date-strip strong {
        font-size: 13px;
        color: var(--green)
    }

.delivery-card-head {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 16px
}

.stop-number {
    min-width: 34px;
    height: 34px;
    background: var(--green);
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900
}

.delivery-customer {
    flex: 1
}

    .delivery-customer h2 {
        margin: 0 0 4px;
        font-size: 19px
    }

    .delivery-customer p {
        margin: 0 0 4px;
        color: var(--muted)
    }

.phone-link {
    font-weight: 800
}

.delivery-card-body {
    display: grid;
    grid-template-columns: 1.6fr .8fr;
    gap: 24px;
    border-top: 1px solid #edf0ef;
    padding: 16px
}

.delivery-section-label {
    display: block;
    font-size: 10px;
    letter-spacing: .1em;
    font-weight: 900;
    color: var(--muted);
    margin-bottom: 9px
}

.delivery-items {
    display: grid;
    gap: 7px
}

.delivery-product {
    display: flex;
    align-items: center;
    gap: 10px
}

    .delivery-product b {
        min-width: 30px;
        height: 30px;
        background: #e9efed;
        border-radius: 7px;
        display: grid;
        place-items: center
    }

.delivery-details {
    border-left: 1px solid #edf0ef;
    padding-left: 20px
}

    .delivery-details > div {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        padding: 6px 0
    }

        .delivery-details > div span {
            color: var(--muted)
        }

.delivery-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fafbfb;
    border-top: 1px solid #edf0ef
}

    .delivery-card-actions form {
        margin: 0
    }

.spacer {
    flex: 1
}

.empty-state {
    text-align: center;
    background: #fff;
    border: 1px dashed #c9d4d0;
    border-radius: 14px;
    padding: 50px 20px;
    color: var(--muted)
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 14px
}

    .permission-grid .panel {
        margin: 0
    }

    .permission-grid h3 {
        margin-top: 0
    }

.narrow {
    max-width: 600px
}

.stack-form {
    display: grid;
    gap: 14px
}

    .stack-form small {
        color: var(--muted);
        font-weight: 400
    }

.login-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg,#092b21,#155440)
}

.login-shell {
    width: min(440px,calc(100% - 32px))
}

.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 30px 70px rgba(0,0,0,.24)
}

.login-brand {
    color: var(--ink);
    margin-bottom: 32px
}

    .login-brand .brand-mark {
        background: var(--green);
        color: #fff
    }

.login-card h1 {
    margin-bottom: 5px
}

.login-card > p {
    color: var(--muted);
    margin-top: 0;
    margin-bottom: 22px
}

.head-actions {
    display: flex;
    gap: 8px
}

    .head-actions form {
        margin: 0
    }

.muted {
    color: var(--muted)
}

@media(max-width:980px) {
    .sidebar {
        display: none
    }

    .main {
        margin: 0;
        padding: 82px 14px 88px
    }

    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 66px;
        background: var(--green);
        color: #fff;
        align-items: center;
        padding: 0 14px;
        z-index: 20
    }

        .mobile-header .brand-mark {
            width: 35px;
            height: 35px
        }

    .mobile-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 70px;
        padding-bottom: env(safe-area-inset-bottom);
        background: #fff;
        border-top: 1px solid var(--line);
        z-index: 30;
        justify-content: space-around
    }

        .mobile-nav a,
        .mobile-nav .mobile-nav-button {
            flex: 1;
            display: grid;
            place-items: center;
            align-content: center;
            gap: 2px;
            color: #65736e;
            font-weight: 700
        }

        .mobile-nav .mobile-nav-button {
            border: 0;
            background: transparent;
            padding: 0;
            margin: 0;
            font-family: inherit;
            cursor: pointer
        }

            .mobile-nav a span,
            .mobile-nav .mobile-nav-button span {
                font-size: 20px;
                line-height: 1
            }

            .mobile-nav a small,
            .mobile-nav .mobile-nav-button small {
                font-size: 10px
            }

        .mobile-nav .mobile-new span {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--green);
            color: #fff;
            display: grid;
            place-items: center;
            margin-top: -16px
        }

    .kpis {
        grid-template-columns: 1fr 1fr
    }

    .permission-grid {
        grid-template-columns: 1fr 1fr
    }

    .load-summary {
        grid-template-columns: 1fr 1fr
    }

    .delivery-card-body {
        grid-template-columns: 1fr
    }

    .delivery-details {
        border-left: 0;
        border-top: 1px solid #edf0ef;
        padding: 14px 0 0
    }

    .page-head h1, .delivery-hero h1 {
        font-size: 26px
    }
}

@media(max-width:680px) {
    body {
        font-size: 14px
    }

    .main {
        padding-left: 10px;
        padding-right: 10px
    }

    .page-head {
        align-items: flex-end
    }

        .page-head > div {
            min-width: 0
        }

        .page-head p {
            display: none
        }

        .page-head > .btn {
            white-space: nowrap
        }

    .panel {
        padding: 14px;
        border-radius: 12px
    }

    .kpis {
        gap: 8px
    }

    .kpi {
        padding: 13px
    }

        .kpi strong {
            font-size: 21px
        }

        .kpi small {
            font-size: 10px
        }

    .form-grid.two, .detail-grid {
        grid-template-columns: 1fr
    }

    .fields.two, .fields.three {
        grid-template-columns: 1fr
    }

    .span-2 {
        grid-column: auto
    }

    .line-item {
        grid-template-columns: 30px 65px 1fr 36px
    }

        .line-item .description {
            grid-column: 3/4
        }

        .line-item label:nth-of-type(3) {
            grid-column: 2/4
        }

    .toolbar {
        display: grid;
        grid-template-columns: 1fr auto
    }

        .toolbar input {
            grid-column: 1/3
        }

    .table-wrap {
        display: none
    }

    .mobile-order-list {
        display: grid
    }

    .mobile-order {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 13px 0;
        border-bottom: 1px solid #edf0ef;
        color: inherit
    }

        .mobile-order > div {
            display: grid;
            gap: 3px
        }

            .mobile-order > div:last-child {
                text-align: right
            }

        .mobile-order small {
            color: var(--muted)
        }

    .page-head {
            display: grid;
            gap: 14px;
            align-items: start;
        }

        .head-actions {
            display: flex;
            width: 100%;
            gap: 8px;
        }

            .head-actions .btn,
            .head-actions form {
                flex: 1;
                width: auto;
            }

                .head-actions form .btn {
                    width: 100%;
                }

            .head-actions .btn {
                min-height: 42px;
                padding: 8px 10px;
                font-size: 12px;
                white-space: nowrap;
            }

    .delivery-hero {
        display: grid;
        gap: 16px
    }

    .date-picker {
        width: 100%
    }

        .date-picker input {
            width: 100%
        }

    .delivery-tabs {
        overflow: auto;
        padding-bottom: 2px
    }

        .delivery-tabs a {
            white-space: nowrap
        }

    .load-summary {
        grid-template-columns: 1fr
    }

    .delivery-summary-strip {
        grid-template-columns: 1fr 1fr;
        gap: 7px
    }

        .delivery-summary-strip > div {
            padding: 10px
        }

    .delivery-date-group {
        position: sticky;
        top: 66px;
        z-index: 5;
        background: var(--bg);
        padding-top: 8px;
        margin-top: 18px
    }

    .delivery-date-strip {
        display: grid;
        gap: 2px
    }

        .delivery-date-strip strong {
            font-size: 14px
        }

    .delivery-card-head {
        padding: 13px
    }

    .delivery-meta {
        position: absolute;
        right: 22px
    }

    .delivery-customer h2 {
        padding-right: 72px;
        font-size: 17px
    }

    .delivery-card-body {
        padding: 13px
    }

    .delivery-card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 10px
    }

        .delivery-card-actions .spacer {
            display: none
        }

        .delivery-card-actions > a {
            grid-column: 1/3
        }

        .delivery-card-actions form, .delivery-card-actions button {
            width: 100%
        }

    .permission-grid {
        grid-template-columns: 1fr
    }

    .login-card {
        padding: 24px
    }

    .head-actions {
        display: grid
    }

    .sticky-head {
        position: sticky;
        top: 66px;
        background: var(--bg);
        z-index: 4;
        padding: 8px 0;
        margin-top: -8px
    }
}

@media print {
    .sidebar, .mobile-header, .mobile-nav, .mobile-more-menu, .page-head .btn, .delivery-tabs, .date-picker, .delivery-card-actions, .van-load .btn {
        display: none !important
    }

    .main {
        margin: 0;
        padding: 0
    }

    .panel, .delivery-card {
        box-shadow: none;
        break-inside: avoid
    }

    .delivery-date-group {
        position: static
    }

    .delivery-list {
        display: block
    }

    .delivery-card {
        margin-bottom: 12px
    }
}

.driver-hero {
    display: grid;
    gap: 5px;
    background: var(--green);
    color: #fff;
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow)
}

    .driver-hero .eyebrow,
    .driver-hero small {
        color: #d7e7e1
    }

    .driver-hero strong {
        font-size: 26px
    }

.delivery-role-home {
    max-width: 700px
}

.required-label {
    display: flex;
    align-items: center;
    gap: 4px
}

    .required-label b {
        color: var(--danger);
        font-size: 15px
    }

.field-validation-error {
    color: var(--danger);
    font-size: 11px;
    font-weight: 700;
    min-height: 14px
}

.input-validation-error {
    border-color: var(--danger) !important;
    background: #fff8f7 !important
}

.payment-status-preview {
    background: #f1f5f3;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px
}

    .payment-status-preview span {
        color: var(--muted);
        font-size: 10px;
        letter-spacing: .1em;
        font-weight: 900
    }

    .payment-status-preview strong {
        color: var(--green);
        font-size: 15px
    }

.delivery-card.collected {
    border-color: #9dcab4;
    opacity: .8
}

.delivery-status.collected,
.status.collected {
    background: #ddf5e8;
    color: #17663c
}

.ops-switcher {
    display: flex;
    gap: 8px;
    margin: 0 0 18px 0;
}

.ops-switcher-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

    .ops-switcher-link:hover {
        background: #f4f7f5;
    }

    .ops-switcher-link.active {
        background: var(--green);
        border-color: var(--green);
        color: #fff;
    }

@media (max-width:700px) {

    .ops-switcher {
        width: 100%;
        margin-bottom: 14px;
    }

    .ops-switcher-link {
        flex: 1;
        padding: 10px 8px;
    }
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    margin-left: 5px;
    border-radius: 999px;
    background: rgba(0,0,0,.08);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.delivery-tabs a.active .tab-count {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.app-alert {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    margin: 0 0 18px;
    padding: 14px 14px 14px 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: opacity .18s ease, transform .18s ease;
}

.app-alert::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
}

.app-alert-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 900;
}

.app-alert-content {
    min-width: 0;
    display: grid;
    gap: 2px;
    line-height: 1.4;
}

.app-alert-content strong {
    font-size: 13px;
    color: var(--ink);
}

.app-alert-content span {
    color: #4d5a56;
    font-size: 14px;
}

.app-alert-close {
    width: 30px;
    height: 30px;
    margin: -2px -3px 0 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.app-alert-close:hover {
    background: rgba(0,0,0,.05);
    color: var(--ink);
}

.app-alert-success::before {
    background: #16834f;
}

.app-alert-success .app-alert-icon {
    background: #e2f4ea;
    color: #17663c;
}

.app-alert-error::before {
    background: var(--danger);
}

.app-alert-error .app-alert-icon {
    background: #fde9e7;
    color: var(--danger);
}

.app-alert-warning::before {
    background: #c27a00;
}

.app-alert-warning .app-alert-icon {
    background: #fff1cf;
    color: var(--warning);
}

.app-alert-leaving {
    opacity: 0;
    transform: translateY(-6px);
}

body.modal-open {
    overflow: hidden;
}

.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(14, 27, 23, .48);
    backdrop-filter: blur(2px);
}

.confirm-modal-backdrop[hidden] {
    display: none;
}

.confirm-modal {
    width: min(100%, 430px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 24px 70px rgba(0,0,0,.24);
}

.confirm-modal-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border-radius: 50%;
    background: #fff1cf;
    color: var(--warning);
    font-size: 20px;
    font-weight: 900;
}

.confirm-modal-copy h2 {
    margin: 0 0 7px;
    font-size: 21px;
}

.confirm-modal-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 22px;
}

.btn.danger {
    background: var(--danger);
    color: #fff;
}

.btn.danger:hover {
    filter: brightness(.94);
}

@media (max-width: 600px) {
    .app-alert {
        margin-left: 0;
        margin-right: 0;
    }

    .confirm-modal-backdrop {
        align-items: end;
        padding: 12px;
    }

    .confirm-modal {
        width: 100%;
        border-radius: 18px;
        padding: 20px;
    }

    .confirm-modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .confirm-modal-actions .btn {
        width: 100%;
    }
}


/* Order details action hierarchy */
.order-detail-actions {
    align-items: center;
}

.order-secondary-actions {
    display: flex;
    gap: 8px;
    order: 1;
}

.order-primary-action {
    display: flex;
    order: 2;
}

.order-primary-action form,
.order-secondary-actions form {
    margin: 0;
}

.order-correction-action {
    color: #5f3f00;
    border-color: #ead8ad !important;
    background: #fffaf0 !important;
}

/* Keep the approved Order Details hierarchy across mobile and tablet. */
@media (max-width: 980px) {
    .page-head:has(.order-detail-actions) {
        display: grid !important;
        grid-template-columns: 1fr !important;
        align-items: start !important;
        justify-content: stretch !important;
        gap: 14px !important;
        margin-bottom: 16px;
    }

    .page-head:has(.order-detail-actions) > div:first-child {
        width: 100%;
    }

    .order-detail-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: 8px;
    }

    .order-primary-action {
        order: 1;
        display: block;
        width: 100%;
    }

    .order-primary-action form,
    .order-primary-action .btn {
        width: 100%;
    }

    .order-primary-action .btn {
        min-height: 44px;
        font-size: 13px;
    }

    .order-secondary-actions {
        order: 2;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
        gap: 8px;
    }

    .order-secondary-actions > a,
    .order-secondary-actions > form {
        width: 100%;
    }

    .order-secondary-actions .btn {
        width: 100%;
        min-height: 40px;
        padding: 8px 9px;
        font-size: 12px;
    }

    .order-secondary-actions > :only-child {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   Mobile polish - Dashboard and Orders
   ========================================================= */

.orders-empty {
    display: grid;
    gap: 4px;
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
}

.orders-empty strong {
    color: var(--ink);
    font-size: 15px;
}

@media (max-width: 980px) {
    /* Dashboard: keep the important numbers readable without wasting space. */
    .kpis {
        gap: 10px;
    }

    .kpi {
        min-width: 0;
    }

    .mini-delivery {
        align-items: center;
    }

    .mini-delivery > div {
        min-width: 0;
    }

    .mini-delivery strong,
    .mini-delivery small {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 680px) {
    /* Orders search: search box first, filter + action underneath. */
    .toolbar {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .toolbar input {
        grid-column: 1 / -1;
        min-height: 44px;
    }

    .toolbar select,
    .toolbar .btn {
        min-height: 44px;
    }

    .toolbar .btn {
        min-width: 86px;
    }

    /* Orders become proper touch-friendly cards on phones. */
    .mobile-order-list {
        gap: 10px;
    }

    .mobile-order {
        align-items: start;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
    }

    .mobile-order:last-child {
        border-bottom: 1px solid var(--line);
    }

    .mobile-order > div:first-child {
        min-width: 0;
    }

    .mobile-order > div:last-child {
        flex: 0 0 auto;
    }

    .mobile-order strong,
    .mobile-order small {
        overflow-wrap: anywhere;
    }

    .mobile-order .eyebrow {
        margin-bottom: 2px;
    }

    /* The surrounding panel should not create a second card around mobile order cards. */
    .panel:has(> .mobile-order-list) {
        padding: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    /* Dashboard delivery rows stay compact and readable. */
    .mini-delivery {
        padding: 12px;
        gap: 10px;
    }

    .mini-delivery .status {
        flex: 0 0 auto;
    }

    /* New/Edit order: make the sticky save area useful rather than bulky. */
    #order-form .sticky-head {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
    }

    #order-form .sticky-head > div:first-child {
        min-width: 0;
    }

    #order-form .sticky-head .eyebrow {
        margin-bottom: 2px;
    }

    #order-form .sticky-head h1 {
        margin-bottom: 0;
        font-size: 22px;
    }

    #order-form .sticky-head > .btn {
        width: auto;
        min-height: 42px;
    }

    #order-form .sticky-head .head-actions {
        display: grid;
        grid-template-columns: auto auto;
        width: auto;
    }

    #order-form .sticky-head .head-actions .btn {
        min-height: 42px;
    }

    /* Line items are cards: description full-width, quantity and price side-by-side. */
    #order-form .line-item {
        grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) 40px;
        gap: 9px;
        align-items: end;
        margin: 0 0 12px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
    }

    #order-form .line-item .line-no {
        grid-column: 1;
        grid-row: 1;
        align-self: start;
    }

    #order-form .line-item label:nth-of-type(1) {
        grid-column: 1 / 3;
        grid-row: 3;
    }

    #order-form .line-item label:nth-of-type(2),
    #order-form .line-item .description {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    #order-form .line-item label:nth-of-type(3) {
        grid-column: 3 / -1;
        grid-row: 3;
    }

    #order-form .line-item .remove {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        width: 40px;
        height: 40px;
        color: var(--danger);
        font-weight: 800;
    }

    #order-form .add-line {
        width: 100%;
        min-height: 44px;
    }

    /* Payment totals remain easy to scan and edit on a narrow screen. */
    .total-row {
        gap: 12px;
    }

    .total-row.editable input {
        width: min(42vw, 150px);
        min-height: 42px;
    }

    .payment-status-preview {
        padding: 12px;
    }

    .totals-card .btn.full {
        min-height: 46px;
        margin-top: 8px;
    }
}

@media (max-width: 430px) {
    .kpi {
        padding: 12px;
    }

    .kpi strong {
        font-size: 20px;
    }

    .mobile-order {
        gap: 8px;
    }

    .mobile-order > div:last-child strong {
        font-size: 14px;
    }

    #order-form .sticky-head {
        grid-template-columns: 1fr;
    }

    #order-form .sticky-head > .btn,
    #order-form .sticky-head .head-actions {
        width: 100%;
    }

    #order-form .sticky-head .head-actions {
        grid-template-columns: 1fr 1fr;
    }

    #order-form .sticky-head .head-actions .btn,
    #order-form .sticky-head > .btn {
        width: 100%;
    }
}



/* Order Details - mobile product list */
.order-products-mobile {
    display: none;
}

@media (max-width: 680px) {
    .order-products-mobile {
        display: grid;
        gap: 10px;
    }

    .order-product-card {
        display: grid;
        gap: 8px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
    }

    .order-product-card-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 12px;
        align-items: start;
    }

    .order-product-card-head strong:first-child {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .order-product-card-head strong:last-child {
        white-space: nowrap;
        text-align: right;
    }

    .order-product-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 14px;
        color: var(--muted);
        font-size: 13px;
    }
}

/* =========================================================
   Mobile polish - Deliveries, Collections, Staff, Reports,
   Settings and shared navigation
   ========================================================= */

@media (max-width: 680px) {
    /* Delivery / collection controls remain easy to tap. */
    .delivery-tabs a {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
    }

    .date-picker input,
    .date-picker .btn,
    .delivery-card-actions .btn,
    .delivery-card-actions button {
        min-height: 44px;
    }

    .delivery-card-actions {
        gap: 8px;
    }

    .delivery-card-actions > a {
        width: 100%;
        justify-content: center;
    }

    .delivery-card-actions form .btn,
    .delivery-card-actions form button {
        justify-content: center;
    }

    .load-summary > div {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* Staff cards and filters are phone-first and touch friendly. */
    .staff-filters input,
    .staff-filters select,
    .staff-filter-actions .btn,
    .staff-mobile-actions .btn,
    .staff-pagination-buttons .btn {
        min-height: 44px;
    }

    .staff-mobile-card {
        padding: 14px;
        margin-bottom: 10px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
    }

    .staff-mobile-card:first-child {
        padding-top: 14px;
    }

    .staff-mobile-card:last-child {
        padding-bottom: 14px;
        border-bottom: 1px solid var(--line);
        margin-bottom: 0;
    }

    .staff-mobile-details {
        gap: 8px;
    }

    .staff-pagination-buttons {
        gap: 8px;
    }

    .staff-pagination-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    /* Business settings: comfortable fields and a clear save action. */
    .settings-section {
        margin-bottom: 12px;
    }

    .settings-grid input,
    .settings-grid textarea {
        min-height: 44px;
    }

    .settings-preview {
        align-items: flex-start;
    }

    .settings-preview > div:last-child {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .settings-actions .btn {
        min-height: 46px;
        justify-content: center;
    }

    /* More menu should never overflow a narrow handset. */
    .mobile-more-menu {
        max-width: calc(100vw - 20px);
    }

    .mobile-more-menu a,
    .mobile-more-menu button {
        min-height: 44px;
    }
}

@media (max-width: 430px) {
    .delivery-summary-strip {
        grid-template-columns: 1fr 1fr;
    }

    .delivery-card-actions {
        grid-template-columns: 1fr;
    }

    .delivery-card-actions > a {
        grid-column: auto;
    }

    .staff-mobile-top {
        gap: 8px;
    }

    .settings-preview {
        padding: 13px;
        gap: 11px;
    }

    .settings-preview-mark {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }
}


/* Add Staff role picker */
.role-picker {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

    .role-picker legend {
        margin-bottom: 8px;
        font-weight: 700;
    }

.role-picker-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.role-option {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

    .role-option input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .role-option span {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 9px 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        color: var(--ink);
        font-weight: 700;
        text-align: center;
        transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    }

    .role-option input:checked + span {
        border-color: var(--green);
        background: var(--green);
        color: #fff;
        box-shadow: 0 0 0 2px rgba(4, 57, 37, .10);
    }

    .role-option input:focus-visible + span {
        outline: 3px solid rgba(4, 57, 37, .18);
        outline-offset: 2px;
    }

@media (max-width: 430px) {
    .role-picker-options {
        grid-template-columns: 1fr 1fr;
    }

    .role-option:last-child {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   Tier 1 final consistency polish
   ========================================================= */

.login-brand {
    min-width: 0;
}

.login-brand > span:last-child {
    min-width: 0;
}

.login-brand strong,
.login-brand small {
    overflow-wrap: anywhere;
}

