/* Parcel Tracking - site styles. Shell ("app-") and components ("m-") are shared with Allied User Management;
   the "Parcel Tracking additions" section at the end is specific to this application. */

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #eceef1; color: #2f373e;
    font-family: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif; font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
a { color: #0b7a85; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.app { display: flex; min-height: 100vh; }
.app-side { flex: none; display: flex; flex-direction: column; width: 248px; padding: 16px 14px 20px;
    background: #2f373e; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-logo { display: block; margin: 0 0 18px; padding: 12px 14px; background: #fff; border-radius: 8px; }
.app-logo img { display: block; width: 100%; height: auto; }
.app-nav { display: grid; gap: 2px; }
.app-link { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: 8px;
    color: #c3ccd4; font-size: 14px; font-weight: 500; text-decoration: none; transition: background-color .15s, color .15s; }
.app-link svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-link:hover { background: #39424a; color: #fff; }
.app-link.active { background: #39424a; color: #fff; box-shadow: inset 3px 0 0 #32c5d2; }
.app-link.active svg { color: #32c5d2; }
.app-link:focus-visible { outline: 2px solid #32c5d2; outline-offset: 2px; }
.app-side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #434d56; }
.app-user { padding: 0 10px 8px; color: #99a8b5; font-size: 12px; overflow-wrap: anywhere; }
.app-user strong { display: block; color: #fff; font-size: 13px; font-weight: 500; }
.app-main { flex: 1 1 auto; min-width: 0; padding: 32px 40px 48px; }
.app-main:has(> .m-login) { background: #2f373e; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

@media (max-width: 900px) {
    .app { flex-direction: column; }
    .app-side { position: static; width: auto; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px;
        overflow-x: auto; }
    .app-logo { flex: none; margin: 0 6px 0 0; padding: 6px 8px; }
    .app-logo img { width: auto; height: 22px; }
    .app-nav { display: flex; gap: 2px; }
    .app-link { white-space: nowrap; }
    .app-side-foot { margin: 0; padding: 0; border: 0; }
    .app-user { display: none; }
    .app-main { padding: 20px 16px 32px; }
}

/* ---------------------------------------------------------------- page */
.m-page { max-width: 1120px; margin: 0; }
.m-page-wide { max-width: none; }
.m-page-narrow { max-width: 760px; }

.m-back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; color: #606e7a; font-size: 14px; font-weight: 500; text-decoration: none; }
.m-back:hover { color: #0b7a85; }
.m-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.m-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.m-head-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.m-head-actions form { margin: 0; }
.m-title { font-size: 26px; font-weight: 500; line-height: 1.2; color: #1f262c; overflow-wrap: anywhere; }
.m-sub { margin-top: 4px; color: #606e7a; font-size: 14px; }
.m-muted { color: #606e7a; }
.m-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline-form { display: inline; margin: 0; }

/* ---------------------------------------------------------------- buttons */
.m-btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 16px; margin: 0;
    border: 1px solid #cfd6de; border-radius: 8px; background: #fff; color: #3d4750;
    font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none;
    cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: background-color .15s, border-color .15s, color .15s; }
.m-btn:hover { background: #f5f7f9; border-color: #99a8b5; color: #1f262c; }
.m-btn:focus { outline: 0; }
.m-btn:focus-visible, .m-back:focus-visible { outline: 2px solid #32c5d2; outline-offset: 2px; }
.m-btn-primary { background: #32c5d2; border-color: #32c5d2; color: #14292d; font-weight: 600; }
.m-btn-primary:hover { background: #22b3c0; border-color: #22b3c0; color: #14292d; }
.m-btn-accent { color: #0b7a85; border-color: #a9e6ec; background: #e6f8fa; }
.m-btn-accent:hover { background: #d3f2f5; border-color: #7fd9e2; color: #075e67; }
.m-btn-danger { color: #c9303c; border-color: #f5c2c6; background: #fff; }
.m-btn-danger:hover { background: #fbe1e3; border-color: #ee9aa1; color: #a3252f; }
.m-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; box-shadow: none; }
.m-btn-block { width: 100%; }
.m-link { color: #0b7a85; font-weight: 500; text-decoration: none; }
.m-link:hover { color: #0b7a85; text-decoration: underline; }

/* ---------------------------------------------------------------- card */
.m-card { margin: 0; background: #fff; border: 1px solid #dde3ec; border-radius: 12px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); overflow: hidden; }
.m-card-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 14px 16px; border-bottom: 1px solid #dde3ec; }
.m-card-bar-end { margin-left: auto; }
.m-card-body { padding: 24px; }
.m-card-section { padding: 22px 24px; border-bottom: 1px solid #dde3ec; }
.m-card-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid #dde3ec; background: #f5f7f9; }
.m-empty { padding: 48px 16px; text-align: center; color: #606e7a; }

/* ---------------------------------------------------------------- search box */
.m-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.m-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
    fill: none; stroke: #99a8b5; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.m-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid #cfd6de; border-radius: 8px;
    background: #fff; color: #1f262c; font-size: 14px; }
.m-search input::placeholder { color: #99a8b5; }
.m-search input:focus { border-color: #32c5d2; outline: 2px solid #a9e6ec; outline-offset: 0; }

/* ---------------------------------------------------------------- table */
.m-table-wrap { overflow-x: auto; }
table.m-table { width: 100%; margin: 0; border: 0; border-collapse: collapse; }
table.m-table th { padding: 10px 16px; background: #f5f7f9; border-bottom: 1px solid #dde3ec; text-align: left;
    color: #606e7a; font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
    cursor: pointer; user-select: none; }
table.m-table th[data-nosort] { cursor: default; }
table.m-table th[data-dir=asc]::after { content: " \25B2"; font-size: 9px; }
table.m-table th[data-dir=desc]::after { content: " \25BC"; font-size: 9px; }
table.m-table td { padding: 12px 16px; border-bottom: 1px solid #e9edf2; vertical-align: middle; }
table.m-table tbody tr:last-child td { border-bottom: 0; }
table.m-table tbody tr:hover { background: #f4fbfc; }
table.m-table .m-col-select { width: 44px; padding-right: 0; }
table.m-table input[type=checkbox], table.m-table input[type=radio] { display: block; width: 16px; height: 16px; margin: 0; accent-color: #17a2b0; cursor: pointer; }
table.m-table[data-row-select] tbody tr { cursor: pointer; }
table.m-table tbody tr:has(.m-col-select input:checked) { background: #e6f8fa; }
.m-strong { font-weight: 500; color: #1f262c; }
.m-nowrap { white-space: nowrap; }

.m-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.m-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border-radius: 50%; background: #e6f8fa; color: #0b7a85; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.m-avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.m-user-name { font-weight: 500; color: #1f262c; }

.m-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.m-actions form { margin: 0; }

/* ---------------------------------------------------------------- status pills */
.m-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; margin-right: 4px;
    border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.m-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.m-pill-ok { background: #ecfdf3; color: #067647; }
.m-pill-off { background: #dde3ec; color: #4b5761; }
.m-pill-warn { background: #fbe1e3; color: #c9303c; }

/* ---------------------------------------------------------------- tabs */
.m-tab-bar { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid #dde3ec; overflow-x: auto; }
.m-tabs .tab-button { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 -1px; padding: 14px 12px;
    background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
    color: #606e7a; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.m-tabs .tab-button:hover { color: #1f262c; }
.m-tabs .tab-button.active { color: #0b7a85; border-bottom-color: #32c5d2; }
.m-tabs .tab-button:focus { outline: 0; }
.m-tabs .tab-button:focus-visible { outline: 2px solid #32c5d2; outline-offset: -2px; }
.m-tabs .tab-panel { display: none; padding: 24px; }
.m-tabs .tab-panel.active { display: block; }
.m-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: #e3e8ee; color: #4b5761; font-size: 12px; font-weight: 500; }
.m-tabs .tab-button.active .m-count { background: #e6f8fa; color: #0b7a85; }
.m-panel-intro { margin: 0 0 16px; }

/* ---------------------------------------------------------------- fields */
.m-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.m-form-stack { display: grid; gap: 18px; }
.m-label { display: block; margin: 0 0 6px; color: #3d4750; font-size: 13px; font-weight: 500; }
.m-input { display: block; width: 100%; height: 40px; padding: 0 12px; border: 1px solid #cfd6de; border-radius: 8px;
    background: #fff; color: #1f262c; font-size: 14px; }
.m-input:focus { border-color: #32c5d2; outline: 2px solid #a9e6ec; outline-offset: 0; }
.m-input[readonly] { background: #f5f7f9; color: #606e7a; }
select.m-input { -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23606e7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 18px 18px; }
.m-hint { display: block; margin: 6px 0 0; color: #606e7a; font-size: 12px; font-weight: 400; }

.m-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid #e9edf2; }
.m-section-title { margin: 0 0 14px; color: #1f262c; font-size: 15px; font-weight: 600; line-height: 1.3; }

/* ---------------------------------------------------------------- switches */
.m-switch-list { display: grid; gap: 16px; }
.m-switch { display: flex; align-items: flex-start; gap: 12px; margin: 0; cursor: pointer; color: #1f262c; }
.m-switch input { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 40px; height: 22px; margin: 0;
    border: 0; border-radius: 999px; background: #cfd6de; cursor: pointer; transition: background-color .15s; }
.m-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); transition: transform .15s; }
.m-switch input:checked { background: #1fb5c3; }
.m-switch input:checked::after { transform: translateX(18px); }
.m-switch input:focus-visible { outline: 2px solid #32c5d2; outline-offset: 2px; }
.m-switch-title { display: block; font-size: 14px; font-weight: 500; line-height: 22px; }
.m-switch .m-hint { margin-top: 0; }
.m-switch-inline { display: inline-flex; align-items: center; }
table.m-table .m-switch input[type=checkbox] { width: 40px; height: 22px; accent-color: auto; }
.m-switch input:disabled { opacity: .6; cursor: progress; }

.m-alert { margin-bottom: 20px; padding: 12px 14px; border: 1px solid #f5c2c6; border-radius: 8px; background: #fbe1e3; }
.m-alert .m-switch-title { color: #a3252f; }
.m-alert .m-hint { color: #c9303c; }

/* ---------------------------------------------------------------- tick cards and choice cards */
.m-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.m-check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 12px; border: 1px solid #dde3ec; border-radius: 8px;
    color: #1f262c; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s; }
.m-check:hover { border-color: #a9e6ec; background: #f4fbfc; }
.m-check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: #17a2b0; cursor: pointer; }
.m-check:has(input:checked) { border-color: #7fd9e2; background: #e6f8fa; color: #075e67; }
.m-check span { min-width: 0; overflow-wrap: anywhere; }
.m-check-upper .m-check { font-size: 13px; text-transform: uppercase; }
.m-check-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.m-check-tools .m-search { max-width: 320px; }
.m-check-tools .m-search input, .m-check-tools .m-btn-sm { height: 34px; }

.m-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.m-choice { display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 14px; border: 1px solid #dde3ec; border-radius: 10px;
    color: #1f262c; cursor: pointer; transition: background-color .15s, border-color .15s; }
.m-choice:hover { border-color: #a9e6ec; background: #f4fbfc; }
.m-choice input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: #17a2b0; cursor: pointer; }
.m-choice:has(input:checked) { border-color: #32c5d2; background: #e6f8fa; }
.m-choice-title { display: block; font-size: 14px; font-weight: 600; line-height: 22px; }
.m-choice .m-hint { margin-top: 2px; font-size: 13px; }

/* ---------------------------------------------------------------- login */
.m-login { width: 100%; max-width: 380px; }
.m-login-logo { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto 22px; }
.m-login .m-title { font-size: 22px; }
.m-login .m-form-stack { margin-top: 20px; }

/* ---------------------------------------------------------------- notification dialog */
.m-modal { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(36, 43, 49, .6); }
.m-modal-box { width: 100%; max-width: 440px; padding: 22px 24px 18px; background: #fff; border-radius: 12px; box-shadow: 0 20px 40px rgba(16, 24, 40, .25); }
.m-modal-body { color: #3d4750; overflow-wrap: anywhere; }
.m-modal-foot { display: flex; justify-content: flex-end; margin-top: 20px; }

@media (max-width: 720px) {
    table.m-table th, table.m-table td { padding-left: 12px; padding-right: 12px; }
    .m-form-grid, .m-choice-grid { grid-template-columns: minmax(0, 1fr); }
    .m-tabs .tab-panel, .m-card-body, .m-card-section { padding: 16px; }
    .m-card-foot { padding: 12px 16px; }
}

/* ================================================================ Parcel Tracking additions */

/* ---------------------------------------------------------------- menu section headings */
.app-nav-label { margin: 14px 10px 4px; color: #8493a0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 900px) {
    .app-nav-label { display: none; }
}

/* ---------------------------------------------------------------- forms */
.m-form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m-span-2 { grid-column: span 2; }
.m-span-all { grid-column: 1 / -1; }
.m-section-first { margin-top: 0; padding-top: 0; border-top: 0; }
.m-input:disabled { background: #f5f7f9; color: #606e7a; opacity: 1; cursor: default; }
select.m-input { text-transform: uppercase; }
.m-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.m-toolbar-end { margin-left: auto; }
.m-toolbar .m-field { flex: 0 1 240px; }
.m-toolbar-bottom { align-items: flex-end; }
.m-gps-link { display: inline-flex; align-items: center; gap: 6px; }
.m-gps-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-tabs .tab-panel.m-panel-flush { padding: 0; }
.m-panel-flush .m-toolbar { margin: 0; padding: 14px 16px; border-bottom: 1px solid #dde3ec; }
.m-upper { text-transform: uppercase; }

@media (max-width: 1100px) {
    .m-form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .m-form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .m-span-2 { grid-column: auto; }
    .m-toolbar .m-field { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- read-only details (driver and tracking pages) */
.m-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; margin: 0; }
.m-facts > div { min-width: 0; }
.m-facts dt { margin: 0 0 2px; color: #606e7a; font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.m-facts dd { margin: 0; color: #1f262c; font-size: 15px; overflow-wrap: anywhere; }
.m-facts dd:empty::after { content: "\2013"; color: #99a8b5; }
.m-facts a { color: #0b7a85; font-weight: 500; text-decoration: none; }
.m-key { font-size: 22px; font-weight: 600; letter-spacing: .02em; color: #1f262c; }
.m-pill-info { background: #e6f8fa; color: #0b7a85; }
.m-pill-lg { height: 28px; padding: 0 12px; font-size: 13px; }

@media (max-width: 900px) {
    .m-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .m-facts { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- large buttons for drivers on a phone */
.m-btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.m-actions-lg { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 20px; }
.m-actions-lg form { display: flex; margin: 0; }
@media (max-width: 720px) {
    .m-actions-lg > *, .m-actions-lg form { flex: 1 1 0; }
    .m-actions-lg .m-btn { width: 100%; padding: 0 10px; }
    .m-title { font-size: 22px; }
}

/* ---------------------------------------------------------------- public tracking pages */
.app-anon .app-main:has(> .m-track) { padding-top: 24px; }
.m-track { max-width: 960px; margin: 0 auto; }
.m-track-logo { display: block; width: 200px; max-width: 60%; height: auto; margin: 0 auto 20px; padding: 10px 14px; background: #fff; border-radius: 8px; }

/* ---------------------------------------------------------------- map pop-up */
.m-map-page { margin: 0; background: #fff; }
.m-map-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #dde3ec; }
.m-map-bar .m-input { flex: 1 1 240px; width: auto; }
.m-map-info { padding: 8px 16px; color: #606e7a; font-size: 13px; }
.m-map-info strong { color: #1f262c; font-weight: 500; }
#mapCanvas { width: 100%; height: calc(100vh - 130px); min-height: 320px; }
