/* ==========================================================================
   Canareef Vehicle — mobile layer
   Load after style.css. Every class is prefixed "m-" so nothing clashes with
   Bootstrap. Layout rules that change existing pages live inside the
   max-width: 767.98px media query at the bottom; desktop is untouched.
   ========================================================================== */

:root {
  --m-bg: #0f1218;
  --m-surface: #171b23;
  --m-surface-2: #1a1f28;
  --m-bar: #12161d;
  --m-sheet: #14181f;
  --m-border: #252b35;
  --m-border-2: #2a303b;
  --m-divider: #222833;
  --m-text: #e8eaee;
  --m-text-2: #dfe3ea;
  --m-muted: #9aa3b2;
  --m-faint: #8a93a3;
  --m-chev: #6f7888;
  --m-primary: #2b6fe8;
  --m-link: #5b9bff;
  --m-success: #22c55e;  --m-success-text: #4ade80;
  --m-danger: #ef4444;   --m-danger-text: #f87171;
  --m-warning: #f59e0b;  --m-warning-text: #fbbf24;
  --m-info: #3b82f6;     --m-info-text: #60a5fa;
  --m-violet-text: #a5b4fc;
  --m-radius: 16px;
  --m-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --m-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- headers ---------- */
.m-large-title { padding: 18px 20px 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.m-large-title h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; color: var(--m-text); }
.m-eyebrow { font-size: 12px; font-weight: 500; color: var(--m-muted); }
.m-navbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 58px; padding: 10px 6px 6px; border-bottom: 1px solid #1d222b; position: sticky; top: 0; z-index: 10; background: var(--m-bg); }
.m-navbar__title { font-size: 16px; font-weight: 650; text-align: center; max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-navbar__btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; padding: 0 10px; background: none; border: 0; color: var(--m-link); font: inherit; font-size: 16px; text-decoration: none; cursor: pointer; }
.m-navbar__btn--start { justify-self: start; }
.m-navbar__btn--end { justify-self: end; font-weight: 650; }

/* ---------- icon buttons ---------- */
.m-icon-btn { position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; background: var(--m-surface); border: 1px solid #262c37; color: var(--m-text); display: inline-flex; align-items: center; justify-content: center; font-size: 19px; cursor: pointer; text-decoration: none; }
.m-icon-btn--primary { background: var(--m-primary); border-color: var(--m-primary); color: #fff; font-weight: 700; font-size: 15px; }
.m-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--m-warning); color: #1a1205; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- cards and grouped lists ---------- */
.m-card { background: var(--m-surface); border: 1px solid var(--m-border); border-radius: var(--m-radius); color: var(--m-text); }
.m-card--pad { padding: 14px 16px; }
.m-list { overflow: hidden; }
.m-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px; background: none; border: 0; color: var(--m-text); font: inherit; font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; }
.m-list .m-row { border-bottom: 1px solid var(--m-divider); margin-bottom: -1px; }
.m-row[disabled], .m-row.is-disabled { cursor: default; opacity: .55; }
.m-row__label { width: 104px; flex-shrink: 0; font-size: 15px; }
.m-row__main { flex: 1; min-width: 0; }
.m-row__title { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row__sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--m-muted); }
.m-row__value { flex: 1; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--m-text); }
.m-row__value.is-placeholder { color: var(--m-faint); }
.m-chev { color: var(--m-chev); font-size: 14px; flex-shrink: 0; }
.m-section { display: flex; flex-direction: column; gap: 8px; }
.m-section-title { margin: 0; padding: 0 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--m-muted); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.m-section-title span { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ---------- icon chips ---------- */
.m-icon-chip { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; }
.m-icon-chip--blue { background: #1b2a48; color: var(--m-link); }
.m-icon-chip--green { background: #12301f; color: var(--m-success-text); }
.m-icon-chip--red { background: #3a1519; color: var(--m-danger-text); }
.m-icon-chip--amber { background: #3a2a0c; color: var(--m-warning-text); }
.m-icon-chip--grey { background: #262c37; color: #c7cdd8; }
.m-icon-chip--violet { background: #25244a; color: var(--m-violet-text); }

/* ---------- pills, dots, counts ---------- */
.m-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 650; white-space: nowrap; flex-shrink: 0; }
.m-dot { width: 7px; height: 7px; border-radius: 4px; flex-shrink: 0; background: currentColor; }
.m-pill--approval { color: var(--m-violet-text); background: rgba(129,140,248,.14); }
.m-pill--works    { color: var(--m-warning-text); background: rgba(245,158,11,.12); }
.m-pill--progress { color: var(--m-info-text); background: rgba(59,130,246,.14); }
.m-pill--complete { color: var(--m-success-text); background: rgba(34,197,94,.12); }
.m-pill--deleted  { color: #fca5a5; background: rgba(220,38,38,.12); }
.m-pill--running  { color: var(--m-success-text); background: rgba(34,197,94,.10); }
.m-pill--down     { color: #fca5a5; background: rgba(220,38,38,.14); }
.m-pill--urgent { color: #fca5a5; background: rgba(220,38,38,.16); border: 1px solid rgba(239,68,68,.45); }
.m-pill--high   { color: #fcd34d; background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.45); }
.m-pill--medium { color: #c7cdd8; background: #262c37; border: 1px solid #3a414d; }
.m-pill--low    { color: #86efac; background: rgba(34,197,94,.14); border: 1px solid rgba(34,197,94,.4); }
.m-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: #262c37; color: var(--m-muted); }
.m-count--warn { background: #3a2a0c; color: var(--m-warning-text); }

/* ---------- segmented control and chips ---------- */
.m-seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--m-surface); border: 1px solid var(--m-border); border-radius: 12px; }
.m-seg--2x2 { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-seg__btn { min-height: 38px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; color: var(--m-muted); font: inherit; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; }
.m-seg__btn.is-on { background: #2a313d; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.m-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 12px; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chip { flex-shrink: 0; height: 36px; padding: 0 8px 0 14px; border-radius: 18px; display: flex; align-items: center; gap: 7px; background: var(--m-surface); color: #c7cdd8; border: 1px solid var(--m-border-2); font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none; }
.m-chip--solo { padding: 0 14px; }
.m-chip.is-on { background: var(--m-primary); border-color: var(--m-primary); color: #fff; }
.m-chip.is-on .m-count { background: rgba(255,255,255,.22); color: #fff; }

/* ---------- inputs ---------- */
.m-search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 12px; background: var(--m-surface-2); border: 1px solid #262c37; color: var(--m-faint); }
.m-input { flex: 1; min-width: 0; height: 50px; background: transparent; border: 0; outline: none; color: var(--m-text); font: inherit; font-size: 16px; } /* 16px stops iOS zooming on focus */
.m-search .m-input { height: 40px; }
.m-input::placeholder, .m-textarea::placeholder { color: #7d8696; }
.m-input[type="date"] { color-scheme: dark; text-align: right; }
.m-textarea { width: 100%; resize: none; padding: 0; background: transparent; border: 0; outline: none; color: var(--m-text); font: inherit; font-size: 16px; line-height: 1.45; }
.m-select { flex: 1; min-width: 0; height: 50px; padding-right: 24px; background: transparent; border: 0; color: var(--m-text); font: inherit; font-size: 15px; text-align: right; text-align-last: right; -webkit-appearance: none; appearance: none; }
.m-error { padding: 0 4px; font-size: 12.5px; color: #fca5a5; }
.m-hint { margin: 0; padding: 0 4px; font-size: 12.5px; line-height: 1.45; color: var(--m-faint); }
.m-note { display: flex; gap: 8px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.45; background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.22); color: #b9c2d0; }
.m-note--warn { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.45); color: #fcd34d; }

/* ---------- buttons ---------- */
.m-btn { flex: 1; min-height: 50px; padding: 0 16px; border-radius: 14px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 16px; font-weight: 650; text-decoration: none; cursor: pointer; }
.m-btn--primary { background: var(--m-primary); color: #fff; }
.m-btn--secondary { background: var(--m-surface-2); color: var(--m-text); border: 1px solid var(--m-border-2); }
.m-btn--success { background: #15803d; color: #fff; }
.m-btn--danger { background: rgba(220,38,38,.14); color: #fca5a5; border: 1px solid rgba(239,68,68,.4); }
.m-btn--danger-solid { background: #b91c1c; color: #fff; }
.m-btn--sm { min-height: 40px; border-radius: 11px; font-size: 14px; padding: 0 12px; }
.m-btn--fit { flex: 0 0 auto; }
.m-btn[disabled] { opacity: .45; cursor: default; }
.m-action-bar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; padding: 12px 16px calc(14px + var(--m-safe-bottom)); background: var(--m-bar); border-top: 1px solid var(--m-divider); }

/* ---------- request card ---------- */
.m-req-card { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 14px; background: none; border: 0; color: var(--m-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.m-req-card__top { display: flex; align-items: center; gap: 8px; }
.m-req-card__id { font-size: 12.5px; color: var(--m-faint); font-variant-numeric: tabular-nums; }
.m-req-card__vehicle { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-req-card__problem { font-size: 14.5px; line-height: 1.4; color: var(--m-text-2); }
.m-req-card__remark { display: flex; gap: 6px; font-size: 12.5px; line-height: 1.35; color: var(--m-muted); }
.m-req-card__foot { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--m-divider); font-size: 12.5px; color: var(--m-muted); }
.m-req-card__actions { display: flex; gap: 8px; padding: 0 14px 14px; }
.m-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-pre { white-space: pre-line; }
.m-day-label { margin: 10px 0 0; padding: 0 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--m-muted); }

/* ---------- dashboard ---------- */
.m-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-kpi { display: flex; flex-direction: column; gap: 8px; padding: 14px; text-align: left; text-decoration: none; color: var(--m-text); }
.m-kpi__value { font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1; }
.m-kpi__label { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--m-muted); }
.m-kpi__foot { font-size: 12px; color: var(--m-muted); }
.m-track { display: block; height: 5px; border-radius: 3px; background: #262c37; overflow: hidden; }
.m-track > span { display: block; height: 100%; border-radius: 3px; }
.m-ring { width: 104px; height: 104px; flex-shrink: 0; border-radius: 52px; display: flex; align-items: center; justify-content: center; }
.m-ring__hole { width: 78px; height: 78px; border-radius: 39px; background: var(--m-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.m-bar-row { display: grid; grid-template-columns: 64px 1fr 22px; align-items: center; gap: 10px; }
.m-bar { height: 10px; border-radius: 5px; background: var(--m-divider); overflow: hidden; }
.m-bar > span { display: block; height: 100%; border-radius: 5px; }

/* ---------- progress steps and timeline ---------- */
.m-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.m-step__bar { height: 5px; border-radius: 3px; background: #262c37; }
.m-step__label { margin-top: 7px; font-size: 11px; line-height: 1.25; color: #7d8696; }
.m-step.is-done .m-step__bar { background: var(--m-success); }
.m-step.is-done .m-step__label { color: var(--m-muted); }
.m-step.is-current .m-step__label { color: var(--m-text); font-weight: 700; }
.m-timeline { display: flex; flex-direction: column; gap: 16px; }
.m-timeline__item { display: flex; gap: 12px; }
.m-timeline__dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 5px; flex-shrink: 0; background: #5c6474; }

/* ---------- photos and stepper ---------- */
.m-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m-photos--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m-photo { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; border-radius: 14px; border: 1px solid var(--m-border); background: var(--m-surface-2); cursor: pointer; }
.m-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-photo__remove { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 13px; border: 0; background: rgba(10,12,16,.75); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.m-photo-add { aspect-ratio: 1; border-radius: 14px; border: 1.5px dashed #343b48; background: #141820; color: var(--m-link); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.m-photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.m-stepper { display: flex; align-items: center; gap: 8px; }
.m-stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--m-border-2); background: var(--m-surface-2); color: var(--m-text); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.m-stepper output { min-width: 34px; text-align: center; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- empty state, toast ---------- */
.m-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 24px; text-align: center; font-size: 14px; line-height: 1.45; color: var(--m-muted); }
.m-toast { position: fixed; left: 16px; right: 16px; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 1090; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #1f2633; border: 1px solid #33405a; color: var(--m-text); font-size: 14px; line-height: 1.35; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: m-toast-in .2s ease-out; }
@keyframes m-toast-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- bottom sheets (More, filters, pickers, confirm, forms) ---------- */
.m-sheet-overlay { position: fixed; inset: 0; z-index: 1080; display: flex; flex-direction: column; justify-content: flex-end; }
.m-sheet-overlay[hidden] { display: none; }
.m-scrim { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: rgba(3,5,8,.62); cursor: pointer; }
.m-sheet { position: relative; max-height: 90%; display: flex; flex-direction: column; background: var(--m-sheet); border-top: 1px solid var(--m-border-2); border-radius: 22px 22px 0 0; color: var(--m-text); animation: m-sheet-up .22s ease-out; }
@keyframes m-sheet-up { from { transform: translateY(48px); opacity: .3; } to { transform: none; opacity: 1; } }
.m-sheet__grip { width: 38px; height: 5px; margin: 8px auto 2px; border-radius: 3px; background: #3a414d; flex-shrink: 0; }
.m-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 20px; }
.m-sheet__head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.m-sheet__body { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; padding: 6px 16px calc(28px + var(--m-safe-bottom)); scrollbar-width: none; }
.m-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m-tile { min-height: 88px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; font-size: 12.5px; font-weight: 600; line-height: 1.25; color: var(--m-text); text-decoration: none; }
.m-tile i { font-size: 22px; }
.m-tile.is-active { border-color: var(--m-primary); color: #8bb8ff; }
.m-avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 18px; background: var(--m-primary); color: #fff; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.m-avatar--lg { width: 48px; height: 48px; border-radius: 24px; font-size: 19px; }

/* ---------- bottom tab bar ---------- */
.m-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; padding: 6px 6px calc(10px + var(--m-safe-bottom)); background: var(--m-bar); border-top: 1px solid var(--m-divider); }
.m-tab { min-height: 46px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; color: var(--m-faint); font: inherit; font-size: 10.5px; font-weight: 500; text-decoration: none; cursor: pointer; }
.m-tab i { font-size: 22px; line-height: 1; }
.m-tab.is-active { color: var(--m-link); font-weight: 650; }
.m-fab { width: 54px; height: 54px; margin-top: -22px; border-radius: 27px; background: var(--m-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 0 8px 20px rgba(43,111,232,.35), 0 0 0 5px var(--m-bg); }

/* ---------- utilities ---------- */
.m-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.m-tabular { font-variant-numeric: tabular-nums; }
.m-stack { display: flex; flex-direction: column; gap: 16px; }
.m-only-phone { display: none; }

/* ==========================================================================
   Phone layout: < 768px
   ========================================================================== */
@media (max-width: 767.98px) {
  body { background: var(--m-bg); font-family: var(--m-font); -webkit-font-smoothing: antialiased; padding-bottom: calc(86px + var(--m-safe-bottom)); }
  .m-only-phone { display: block; }
  .m-only-desktop { display: none !important; }

  /* page body: give content room and hide desktop chrome */
  .app-main { padding: 8px 16px 24px; }
  .app-footer { display: none; }
  .surface { background: transparent; border: 0; padding: 0; box-shadow: none; }

  /* existing stacked tables: turn each row into a card */
  .table-stack thead { display: none; }
  .table-stack tr { display: block; margin-bottom: 10px; background: var(--m-surface); border: 1px solid var(--m-border); border-radius: var(--m-radius); padding: 12px 14px; }
  .table-stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; }

  /* buttons and inputs reach the 44px touch target */
  .btn, .form-control, .form-select { min-height: 44px; }
  .form-control, .form-select { font-size: 16px; }
}
@media (min-width: 768px) {
  .m-tabbar, .m-only-phone { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .m-sheet, .m-toast { animation: none; }
}

/* ==========================================================================
   Project additions (not part of the design hand-off)
   ========================================================================== */

/* full-screen photo viewer */
.m-viewer { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; background: #000; }
.m-viewer[hidden] { display: none; }
.m-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.m-viewer__done { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 8px; min-height: 44px; padding: 0 14px; background: none; border: 0; color: var(--m-link); font: inherit; font-size: 16px; font-weight: 650; }

/* collapsible department groups on Vehicles */
.m-group__head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 16px; background: none; border: 0; color: var(--m-text); font: inherit; text-align: left; cursor: pointer; }
.m-group__head .m-chev { transition: transform .18s ease; }
.m-group.is-open .m-group__head .m-chev { transform: rotate(90deg); }
.m-group__body { display: none; border-top: 1px solid var(--m-divider); }
.m-group.is-open .m-group__body { display: block; }

/* form rows */
.m-field { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; }
.m-field > i { color: var(--m-faint); font-size: 18px; }
.m-field--area { align-items: flex-start; padding: 14px 16px 10px; }
.m-list > .m-field, .m-list > .m-row { border-bottom: 1px solid var(--m-divider); }
.m-list > :last-child { border-bottom: 0; margin-bottom: 0; }
.m-form { display: flex; flex-direction: column; gap: 16px; }
.m-hscroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.m-hscroll::-webkit-scrollbar { display: none; }
.m-loadmore { width: 100%; flex: none; }
.m-link { color: var(--m-link); font-weight: 600; text-decoration: none; background: none; border: 0; font: inherit; padding: 0; cursor: pointer; }

@media (max-width: 767.98px) {
  /* The phone layout supplies its own headers, so the desktop top bar goes. */
  .app-nav, .app-drawer, .app-backdrop { display: none !important; }
  .app-main { padding: 0; max-width: none; }
  .m-body { display: flex; flex-direction: column; gap: 16px; padding: 8px 16px 28px; }
  body.m-no-tabs { padding-bottom: 0; }
  body.m-no-tabs .m-tabbar { display: none; }
  body.m-no-tabs .m-action-bar { position: fixed; left: 0; right: 0; bottom: 0; }
  body.m-no-tabs .m-body { padding-bottom: calc(96px + var(--m-safe-bottom)); }

  /* Toasts at the top, as the design shows. */
  .toast-stack { top: calc(14px + env(safe-area-inset-top, 0px)); bottom: auto; left: 16px; right: 16px; z-index: 1090; }
  .toast-msg { min-width: 0; max-width: none; padding: 12px 14px; border-radius: 14px; background: #1f2633; border-color: #33405a; font-size: 14px; }
  @keyframes toast-in  { from { opacity: 0; transform: translateY(-12px); } }
  @keyframes toast-out { to   { opacity: 0; transform: translateY(-12px); } }
}

@media (max-width: 767.98px) {
  /* Login: a clean app sign-in screen instead of the glowing desktop card. */
  body.login-page { background: var(--m-bg); padding-bottom: 0; }
  body.login-page::before, body.login-page::after { display: none; }
  .login-container { display: block; padding: 0; min-height: 100vh; }
  .m-login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 26px; padding: 24px 24px 32px; }
}

/* Chips, segments and text links keep their designed size but get a 44px tap area. */
.m-chip, .m-seg__btn { position: relative; }
.m-chip::after, .m-seg__btn::after { content: ""; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; }
.m-link { display: inline-block; padding: 12px 4px; margin: -12px -4px; }
.m-btn--sm { position: relative; }
.m-btn--sm::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }

/* Native dropdown lists follow the dark theme instead of the browser's white default. */
.m-select, .m-input, .m-textarea, .m-search input { color-scheme: dark; }
.m-select option, .m-select optgroup { background: var(--m-sheet); color: var(--m-text); }
.m-select option:checked { background: #2a313d; color: #fff; }
.m-select option:disabled { color: var(--m-faint); }

/* Dropdown rows: the whole row is the tap target and opens the picker sheet. */
.m-row > select.m-select { pointer-events: none; }
.m-row:has(> select.m-select:not(:disabled)) { cursor: pointer; }
#mPicker .m-row[aria-selected="true"] { background: rgba(43,111,232,.08); }
#mPicker .m-row:active { background: var(--m-surface-2); }
.m-sheet:focus { outline: none; }

/* Out of Order status pill, and an odd last option in the 2 x 2 status picker spans the row. */
.m-pill--ooo { color: #fb923c; background: rgba(249,115,22,.14); }
.m-seg--2x2 > :last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Tick rows for multi-select sheets (e.g. report vehicle types). */
.m-check-row { position: relative; cursor: pointer; }
.m-check-row input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.m-check-row .m-tick { width: 24px; height: 24px; flex-shrink: 0; border-radius: 7px; border: 1.5px solid #3a414d; display: flex; align-items: center; justify-content: center; color: transparent; font-size: 15px; transition: background-color .12s ease, border-color .12s ease; }
.m-check-row input:checked ~ .m-tick { background: var(--m-primary); border-color: var(--m-primary); color: #fff; }
.m-check-row input:focus-visible ~ .m-tick { outline: 2px solid var(--m-link); outline-offset: 2px; }
