/* Field Work only: neutral controls, repair-status colors, jobs before history. */
@media screen {
  body:has(#view-mobile.active) { background: #f3f4f6; }
  #view-mobile {
    --ink: #24303d;
    --muted: #526170;
    --line: #cbd2da;
    --panel: #fff;
    color: var(--ink);
    background: #f3f4f6;
  }
  .app-shell:has(#view-mobile.active) > .sidebar { background: #26313d; }
  .app-shell:has(#view-mobile.active) .topbar { background: #fff; color: #24303d; box-shadow: none; }
  .app-shell:has(#view-mobile.active) .topbar h1 { color: #24303d; }
  #view-mobile .page-intro { margin-bottom: 12px; padding: 0; gap: 12px; }
  #view-mobile .page-intro h2 { margin: 0; font-size: 1.6rem; }
  #view-mobile .mobile-page-actions { gap: 8px; flex-wrap: wrap; }
  #view-mobile :is(.soft-button, #mobile-open-tickets, .mobile-command-date, .mobile-route-link, .phone-end) {
    min-height: 44px; padding: 8px 12px; color: #24303d; background: #fff;
    border: 1px solid #b9c3cd; border-radius: 6px; box-shadow: none; font-size: .875rem;
  }
  #view-mobile .mode-switch { background: #fff; border-color: #cbd2da; border-radius: 6px; }
  #view-mobile .mode-switch button { min-height: 44px; font-size: .875rem; color: #526170; }
  #view-mobile .mode-switch button.active { color: #24303d; background: #edf0f3; box-shadow: inset 0 -3px #24303d; border-radius: 0; }
  #view-mobile .tech-mobile-shell { padding: 0; background: #f3f4f6; border: 0; box-shadow: none; border-radius: 0; }
  #view-mobile .mobile-command-bar {
    grid-template-columns: minmax(140px, 1fr) auto auto; align-items: end;
    padding: 10px 0; gap: 10px; border-radius: 0; background: transparent; color: #24303d;
  }
  #view-mobile .mobile-command-person { min-width: 0; }
  #view-mobile .mobile-tech-picker { margin: 0; width: 100%; max-width: 280px; }
  #view-mobile .mobile-tech-picker span { color: #526170; font-size: .875rem; letter-spacing: normal; }
  #view-mobile .mobile-tech-picker select { width: 100%; min-height: 44px; font-size: 1rem; background: #fff; color: #24303d; }
  #view-mobile .mobile-command-date { border-bottom: 3px solid #24303d; font-size: 1rem; }
  #view-mobile #mobile-ticket-search { font-size: 1rem; min-height: 44px; }
  #view-mobile .mobile-calendar-panel { margin: 0 0 10px; padding: 12px; border-bottom: 1px solid #cbd2da; background: #fff; }
  #view-mobile :is(.mobile-day, .mobile-month-day) { color: #24303d; background: #fff; border-color: #d1d7df; }
  #view-mobile :is(.mobile-day, .mobile-month-day).selected { color: #24303d; background: #edf0f3; border-color: #24303d; box-shadow: inset 0 -3px #24303d; }
  #view-mobile :is(.mobile-day, .mobile-month-day) :is(span, small) { color: #526170; font-size: .75rem; }
  #view-mobile .mobile-ticket-filter { margin: 4px 0 8px; gap: 0; border-bottom: 1px solid #cbd2da; }
  #view-mobile .mobile-ticket-filter button {
    min-height: 44px; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
    color: #526170; background: transparent; font-size: 1rem;
  }
  #view-mobile .mobile-ticket-filter button.active { color: #17212c; background: #fff; border-bottom-color: #17212c; }
  #view-mobile .mobile-route-summary {
    padding: 4px 0 8px; margin: 0; color: #24303d; background: transparent; border: 0; border-radius: 0;
  }
  #view-mobile .mobile-route-summary > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  #view-mobile .mobile-route-summary :is(h3, p, .section-kicker) { margin: 0; color: #526170; font-size: .875rem; }
  #view-mobile .mobile-route-summary h3 { color: #24303d; }
  #view-mobile .mobile-job-list { margin-top: 0; }
  #view-mobile .mobile-job-shell { background: var(--work-soft); }
  #view-mobile .mobile-job-shell.mobile-work-todo { --work-color: #1d4ed8; --work-ink: #1e40af; --work-soft: #e7efff; }
  #view-mobile .mobile-job-shell.mobile-work-pending { --work-color: #b42336; --work-ink: #9f1239; --work-soft: #fff0f1; }
  #view-mobile .mobile-job-shell.mobile-work-done { --work-color: #205b2a; --work-ink: #133b19; --work-soft: #205b2a; }
  #view-mobile .mobile-ticket-open small { color: var(--work-ink); font-size: .875rem; font-weight: 750; }
  #view-mobile .mobile-job-product { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  #view-mobile .mobile-job-technician { color: #24303d; font-size: .875rem; }
  #view-mobile .mobile-work-done .mobile-job-technician { color: #fff; }
  #view-mobile .mobile-job-rail small { color: #fff; font-size: .75rem; }
  #view-mobile .mobile-job-rail strong { font-size: .875rem; }
  #view-mobile .mobile-job-rail > span:last-child { font-size: .75rem; }
  #view-mobile .mobile-work-done :is(.mobile-ticket-open, .mobile-ticket-open strong, .mobile-ticket-open small,
    .mobile-ticket-open > b, .mobile-job-customer, .mobile-job-customer strong, .mobile-service-line, .mobile-service-line b, .mobile-job-product) { color: #fff; }
  #view-mobile .mobile-job-actions :is(a, button) { min-height: 44px; background: #fff; color: #24303d; border: 1px solid #b9c3cd; font-size: .875rem; }
  #view-mobile .mobile-job-actions button:disabled { color: #64717e; background: #eef0f2; }
  #view-mobile .field-team-card { color: #24303d; background: #fff; }
  #view-mobile .field-team-card.selected { color: #24303d; background: #edf0f3; border-color: #24303d; box-shadow: inset 0 -3px #24303d; }
  #view-mobile .field-team-card :is(small, .field-team-metrics) { color: #526170; font-size: .75rem; }
  #view-mobile .mobile-history-overview { margin-top: 16px; padding: 10px 0; border-top: 1px solid #cbd2da; color: #526170; }
  #view-mobile .mobile-history-overview summary { min-height: 44px; padding: 10px 0; color: #24303d; cursor: pointer; font-weight: 650; }
  #view-mobile .mobile-kpi-grid > article { min-height: 0; padding: 8px; }
  #view-mobile .mobile-kpi-grid strong { font-size: 1.25rem; }
  #view-mobile .mobile-kpi-grid small { font-size: .75rem; }
  #view-mobile .mobile-history-range { padding: 8px 0; border: 0; background: transparent; font-size: .875rem; }
  #view-mobile #mobile-history-count { font-size: .875rem; }
  #view-mobile :is(button, a, select, summary):focus-visible { outline: 3px solid #17212c; outline-offset: 3px; }
  @media (max-width: 820px) {
    #view-mobile .page-intro { align-items: flex-start; }
    #view-mobile .mobile-command-bar { grid-template-columns: minmax(0, 1fr) auto; }
    #view-mobile .mobile-command-person { grid-column: 1 / -1; }
    #view-mobile .mobile-tech-picker { max-width: none; }
    #view-mobile .mobile-command-date { justify-self: start; }
    #view-mobile .mobile-route-link { justify-self: end; }
    #view-mobile .mobile-job-shell { grid-template-columns: 72px minmax(0, 1fr); }
    #view-mobile .mobile-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #view-mobile .mobile-job-body { min-width: 0; overflow-wrap: anywhere; }
  }
  @media (forced-colors: active) {
    #view-mobile .mobile-job-shell { border-color: CanvasText; }
    #view-mobile .mobile-ticket-filter button.active { border-bottom-color: Highlight; }
  }
}

/* Dense working surface: keep every action and warning, remove the tall status rail. */
@media screen {
  .app-shell:has(#view-mobile.active) .topbar h1 { display: none; }
  #view-mobile .page-intro { margin-bottom: 6px; }
  #view-mobile .page-intro h2 { font-size: 1.25rem; }
  #view-mobile .mobile-command-bar { padding: 4px 0; }
  #view-mobile .mobile-route-summary { padding-bottom: 6px; }
  #view-mobile .mobile-job-list { gap: 10px; align-items: start; }
  #view-mobile .mobile-job-shell {
    display: block; min-height: 0; padding: 0;
    background: #fff; border-left: 4px solid var(--work-color);
  }
  #view-mobile .mobile-job-rail {
    display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 8px;
    min-height: 0; padding: 5px 10px; background: #f5f7fa; color: #526170;
    border-bottom: 1px solid #e3e7ec;
  }
  #view-mobile .mobile-job-rail :is(strong, small, span:last-child) {
    color: #526170; font-size: .75rem; font-weight: 500; margin: 0;
    padding: 0; background: transparent; border-radius: 0;
  }
  #view-mobile .mobile-job-rail .mobile-stop-number {
    width: auto; height: auto; min-width: 0; color: #24303d; font-size: .875rem; font-weight: 700;
  }
  #view-mobile .mobile-job-rail > span:last-child { width: auto; margin-left: auto; }
  #view-mobile .mobile-job-body { padding: 7px 10px 8px; }
  #view-mobile .mobile-ticket-open { min-height: 0; align-items: start; flex-wrap: nowrap; margin: 0 0 3px; padding: 0; }
  #view-mobile .mobile-ticket-open > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
  #view-mobile .mobile-ticket-open strong { display: inline; font-size: 1rem; line-height: 1.25; color: #24303d; }
  #view-mobile .mobile-ticket-open .ticket-unread-badge { display: inline-block; margin: 0 0 0 6px; vertical-align: middle; }
  #view-mobile .mobile-ticket-open small { display: block; margin-top: 2px; line-height: 1.25; color: var(--work-ink); font-weight: 650; }
  #view-mobile .mobile-ticket-open > b { color: #526170; font-size: 20px; flex-shrink: 0; }
  #view-mobile .mobile-work-done :is(.mobile-ticket-open strong, .mobile-job-customer strong, .mobile-service-line b) { color: #24303d; }
  #view-mobile .mobile-work-done .mobile-ticket-open small { color: #205b2a; }
  #view-mobile .mobile-job-customer strong { color: #24303d; font-size: 1rem; font-weight: 650; }
  #view-mobile .phone-job :is(.mobile-job-customer, .mobile-service-line, .mobile-job-product, .mobile-job-technician) {
    margin: 3px 0; color: #364555; font-size: .875rem; line-height: 1.3;
  }
  #view-mobile .mobile-service-line b { color: #24303d; font-weight: 600; }
  #view-mobile .mobile-job-actions { margin-top: 6px; gap: 6px; }
  #view-mobile .mobile-job-actions :is(a, button) { padding: 5px 8px; min-height: 36px; font-weight: 600; }
  #view-mobile :is(.mobile-csr-note, .ticket-payment-alert-mobile) {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px;
    margin: 6px 0 0; padding: 5px 7px; border-left-width: 3px; border-radius: 3px;
  }
  #view-mobile .mobile-csr-note span { display: block; max-height: none; overflow: visible; font-size: .875rem; font-weight: 500; }
  #view-mobile .mobile-csr-note small { flex-basis: 100%; font-weight: 400; }
  #view-mobile .ticket-payment-alert-mobile > strong { font-size: .875rem; }
  #view-mobile .ticket-payment-alert-mobile > small { flex-basis: 100%; font-weight: 500; }
  #view-mobile .field-mobile-mode .mobile-job-body { padding: 5px 8px 6px; }
  #view-mobile .field-mobile-mode .phone-job p { margin-top: 2px; margin-bottom: 2px; }
}
@media screen and (max-width: 820px) {
  #view-mobile .page-intro { gap: 6px; }
  #view-mobile .mobile-page-actions { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 4px; width: 100%; }
  #view-mobile .mobile-page-actions :is(button, .mode-switch button) { padding: 5px 6px; font-size: .875rem; }
  #view-mobile .mobile-page-actions .tech-view-switch { width: auto; }
  #view-mobile .mobile-command-bar { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
  #view-mobile .mobile-command-person { grid-column: auto; }
  #view-mobile .mobile-command-date { grid-column: 2; grid-row: 1; padding: 6px; font-size: .875rem; }
  #view-mobile .mobile-route-link { grid-column: 3; grid-row: 1; padding: 6px; }
  #view-mobile .mobile-tech-picker { display: flex; align-items: center; gap: 8px; }
  #view-mobile .mobile-tech-picker span { display: none; }
  #view-mobile .mobile-job-actions :is(a, button) { min-height: 44px; }
  #view-mobile .mobile-job-list { gap: 8px; }
}
