/* HackWerk's mobile presentation layer. Domain routes, forms and permissions stay
   shared with the desktop application; this file only changes the app shell. */
.mobile-app-bar,
.mobile-primary-action,
.driver-tour,
.driver-mobile-availability,
.admin-tour {
  display: none;
}

.calendar-read-only-compact {
  display: none;
}

@media (min-width: 1051px) {
  .driver-mobile-availability {
    display: grid;
    gap: .55rem;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: .85rem;
    background: var(--surface);
  }
}

@media (max-width: 1050px) {
  :root {
    --mobile-app-bar-height: 54px;
    --mobile-header-offset: calc(var(--mobile-app-bar-height) + env(safe-area-inset-top));
    --mobile-nav-height: 60px;
  }

  body:has(.mobile-bottom-nav) {
    padding-bottom: calc(var(--mobile-nav-height) + .5rem + env(safe-area-inset-bottom));
  }

  body:has(.mobile-bottom-nav) .site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    padding-top: env(safe-area-inset-top);
  }

  .site-header__inner--desktop {
    display: none;
  }

  .mobile-app-bar {
    width: min(100%, 70rem);
    min-height: var(--mobile-app-bar-height);
    margin-inline: auto;
    padding-inline: max(.5rem, env(safe-area-inset-left)) max(.5rem, env(safe-area-inset-right));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .35rem;
  }

  .mobile-app-bar__brand {
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    color: var(--ink);
    text-decoration: none;
  }

  .mobile-app-bar__brand .wordmark__mark {
    width: 2.15rem;
    height: 2.15rem;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 800;
  }

  .mobile-context-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-self: end;
    gap: .35rem;
  }

  .mobile-context-action,
  .mobile-primary-action {
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    border-radius: var(--radius-control);
  }

  .mobile-context-action {
    display: inline-grid;
    padding: .55rem;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--moss);
    background: var(--surface);
    cursor: pointer;
  }

  .mobile-context-action svg,
  .mobile-primary-action svg,
  .mobile-nav-item__icon {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .mobile-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .55rem .7rem;
    border: 1px solid var(--moss);
    color: white;
    background: var(--moss);
    font-size: .78rem;
    font-weight: 850;
    line-height: 1.1;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-primary-action:hover,
  .mobile-primary-action:focus-visible,
  .mobile-primary-action[aria-current="page"] {
    color: white;
    background: #173f2d;
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .mobile-bottom-nav > a,
  .mobile-bottom-nav > button,
  .mobile-more--fallback > summary {
    gap: .2rem;
    align-content: center;
    line-height: 1.15;
  }

  .mobile-nav-item__icon {
    display: block;
  }

  .mobile-nav-item__label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-list-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-list-toolbar > .list-sort-controls {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  }

  body:has(.planning-page, .route-planner-page, .customer-job-form-page, details[open] form[data-sticky-actions]) {
    padding-bottom: calc(var(--mobile-nav-height) + .75rem + env(safe-area-inset-bottom));
  }

  body:has(.planning-page, .route-planner-page, .customer-job-form-page, details[open] form[data-sticky-actions]) .mobile-bottom-nav {
    display: grid;
  }

  body:has(.mobile-bottom-nav) .planning-selection,
  body:has(.mobile-bottom-nav) form[data-sticky-actions] > .form-actions,
  body:has(.mobile-bottom-nav) form[data-sticky-actions] > * > .form-actions:last-child,
  body:has(.mobile-bottom-nav) .route-sticky-navigation {
		bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + .5625rem);
		scroll-margin-block-end: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + .75rem);
  }
}

@media (max-width: 1050px) {
	.list-sort-controls {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-items: end;
		gap: .35rem;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: transparent;
	}

	.list-sort-controls label { min-width: 0; display: grid; gap: .25rem; }
	.list-sort-controls .button { width: 100%; margin: 0; }
	.customer-list-toolbar > .list-sort-controls { grid-column: 1; }
	.profile-section-nav { top: calc(var(--mobile-app-bar-height) + env(safe-area-inset-top) + .25rem); margin-inline: -.25rem; border-radius: .5rem; }
	.profile-card[id] { scroll-margin-top: calc(var(--mobile-app-bar-height) + 4.5rem); }
	.users-heading { align-items: stretch; flex-direction: column; gap: .75rem; }
	.users-heading__actions { align-items: stretch; flex-wrap: wrap; }
	.user-directory-search { width: 100%; flex: 1 1 100%; }
	.route-location-card { gap: 0; padding: 0; overflow: hidden; }
	.route-location-card__summary { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem; cursor: pointer; }
	.route-location-card__summary > span:first-child { min-width: 0; display: grid; gap: .15rem; }
	.route-location-card__summary small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
	.route-location-card__badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem; }
	.route-location-card[open] > .route-location-card__summary { border-bottom: 1px solid var(--line); background: var(--moss-light); }
	.route-location-card__body,
	.route-location-card > .form-grid { padding: .75rem; }

  .mobile-app-bar {
    gap: .35rem;
  }

  .command-search-fallback--mobile .command-search-fallback__panel {
    position: fixed;
    inset: calc(var(--mobile-header-offset) + .25rem) max(.5rem, env(safe-area-inset-right)) auto max(.5rem, env(safe-area-inset-left));
    width: auto;
    max-width: none;
    max-height: calc(var(--visual-viewport-height, 100dvh) - var(--mobile-app-bar-height) - var(--mobile-nav-height) - 1rem);
    overflow: auto;
  }

  .mobile-more-trigger {
    position: relative;
  }

  .mobile-more-trigger[aria-expanded="true"] {
    z-index: calc(var(--z-popover) + 2);
    background: var(--moss-light);
  }

  .mobile-more__dialog::backdrop {
    background: var(--overlay-backdrop);
  }

  .mobile-more__dialog {
    position: fixed;
    z-index: calc(var(--z-popover) + 1);
    inset: auto max(.5rem, env(safe-area-inset-right)) calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + .25rem) max(.5rem, env(safe-area-inset-left));
    width: auto;
    max-width: none;
    max-height: min(72dvh, calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 1.25rem), calc(var(--visual-viewport-height, 100dvh) - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 1.25rem));
    margin: 0;
    padding: 0;
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  }

  .mobile-more__panel {
    max-height: inherit;
    padding: .75rem;
    overscroll-behavior: contain;
  }

  .mobile-more__panel--fallback {
    max-height: min(72dvh, calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 1rem));
  }

  .mobile-more__panel::before {
    width: 2.75rem;
    height: .25rem;
    margin: 0 auto .45rem;
    border-radius: 999px;
    background: var(--line);
    content: "";
  }

  .command-palette,
  .shortcut-help {
    width: 100vw;
    max-width: none;
    max-height: min(92dvh, var(--visual-viewport-height, 92dvh));
    margin: auto 0 0;
    padding: .9rem max(.8rem, env(safe-area-inset-right)) max(.9rem, env(safe-area-inset-bottom)) max(.8rem, env(safe-area-inset-left));
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  }

  .install-prompt {
    position: fixed;
    z-index: var(--z-banner);
    inset: auto max(.5rem, env(safe-area-inset-right)) calc(var(--mobile-nav-height) + .5rem + env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
    width: auto;
    max-height: min(60dvh, var(--visual-viewport-height, 28rem));
    margin: 0;
    overflow: auto;
    box-shadow: var(--overlay-shadow);
  }
}

/* Authenticated pages become a deliberate phone application below this point.
   The desktop layout remains owned by app.css; these rules only reshape its
   existing semantic regions for touch, safe areas and narrow viewports. */
@media (max-width: 1050px) {
  :root {
    --mobile-gutter: .55rem;
    --mobile-section-gap: .5rem;
    --mobile-control-gap: .35rem;
    --mobile-card-radius: .75rem;
    --mobile-sticky-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  html {
    scroll-padding-top: calc(var(--mobile-app-bar-height) + env(safe-area-inset-top) + .5rem);
    scroll-padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + .75rem);
  }

  body:has(.mobile-bottom-nav) :where([id]) {
    scroll-margin-top: calc(var(--mobile-header-offset) + .5rem);
  }

  body:has(.mobile-bottom-nav) {
    background: var(--paper);
  }

  body:has(.mobile-bottom-nav) .page {
    width: calc(100% - (2 * var(--mobile-gutter)));
    max-width: none;
    min-width: 0;
    padding-block: .5rem 1rem;
  }

  body:has(.mobile-bottom-nav) .page > *,
  body:has(.mobile-bottom-nav) :where(form, fieldset, details, section, article, table, dl) {
    min-width: 0;
    max-width: 100%;
  }

  body:has(.mobile-bottom-nav) :where(img, svg, video, canvas) {
    max-width: 100%;
  }

  body:has(.mobile-bottom-nav) :where(h1, h2, h3, h4, p, dd, td) {
    overflow-wrap: break-word;
    word-break: normal;
  }

  body:has(.mobile-bottom-nav) :where(code, [data-copy-value]) {
    overflow-wrap: anywhere;
  }

  body:has(.mobile-bottom-nav) .status-badge {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: normal;
  }

  body:has(.mobile-bottom-nav) :where(a, button, input, select, summary, [tabindex]):focus {
    scroll-margin-block-end: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + .75rem);
  }

  body:has(.mobile-bottom-nav) .page-heading,
  body:has(.mobile-bottom-nav) .dashboard-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: .4rem;
    margin-bottom: .5rem;
  }

  body:has(.mobile-bottom-nav) .page-heading h1,
  body:has(.mobile-bottom-nav) .dashboard-intro h1,
  .profile-hero h1 {
    margin-block: 0 .15rem;
    font-size: clamp(1.55rem, 7vw, 1.95rem);
    line-height: 1.04;
  }

  body:has(.mobile-bottom-nav) .page-heading p:not(.eyebrow),
  body:has(.mobile-bottom-nav) .dashboard-intro p:not(.eyebrow) {
    margin-block: .15rem 0;
    font-size: .84rem;
    line-height: 1.35;
  }

  body:has(.mobile-bottom-nav) .page-heading > .button,
  body:has(.mobile-bottom-nav) .page-heading > .action-row,
  body:has(.mobile-bottom-nav) .page-heading > form {
    width: 100%;
  }

  body:has(.mobile-bottom-nav) .page-heading > .button {
    margin: 0;
  }

  body:has(.mobile-bottom-nav) :where(.form-card, .module-card, .record-card, .job-card, .waitlist-card, .table-card, .profile-card, .user-card, .voice-capture, .transcript-card, .privacy-notice, .duplicate-review, .calendar-waitlist, .calendar-board, .calendar-agenda, .route-map-panel, .route-next-stop) {
    border-radius: var(--mobile-card-radius);
    box-shadow: 0 .35rem 1rem rgb(29 40 31 / 6%);
  }

  body:has(.mobile-bottom-nav) :where(.form-card, .module-card, .profile-card, .voice-capture, .transcript-card, .privacy-notice, .duplicate-review) {
    width: 100%;
    padding: .65rem;
  }

  body:has(.mobile-bottom-nav) :where(.filter-bar, .filter-grid, .compact-create-panel) {
    margin-bottom: var(--mobile-section-gap);
    padding: .55rem;
    border-radius: var(--mobile-card-radius);
  }

  body:has(.mobile-bottom-nav) .compact-filter-panel {
    margin-bottom: var(--mobile-section-gap);
    padding: 0;
    border-radius: var(--mobile-card-radius);
  }

  body:has(.mobile-bottom-nav) .compact-filter-panel > .action-row {
    margin: 0;
    padding: .55rem;
    border-top: 1px solid var(--line);
  }

  body:has(.mobile-bottom-nav) :where(.filter-grid, .form-grid, .exception-create) {
    grid-template-columns: minmax(0, 1fr);
    gap: .5rem;
  }

  body:has(.mobile-bottom-nav) .span-2 {
    grid-column: auto;
  }

  body:has(.mobile-bottom-nav) :where(.form-actions, .filter-bar .action-row, .filter-grid .action-row, .compact-filter-panel .action-row) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .45rem;
  }

  body:has(.mobile-bottom-nav) :where(.form-actions, .filter-bar, .filter-grid, .compact-filter-panel) .button,
  body:has(.mobile-bottom-nav) .form-actions > form {
    width: 100%;
    margin: 0;
  }

  body:has(.mobile-bottom-nav) :where(.edit-card, .compact-create-panel, .route-secondary-metrics, .route-stop-reorder, .route-reorder-panel) > summary {
    min-height: 44px;
    padding-block: .45rem;
    touch-action: manipulation;
  }

  body:has(.mobile-bottom-nav) :where(.responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td) {
    width: 100%;
    display: block;
  }

  body:has(.mobile-bottom-nav) .responsive-table {
    min-width: 0;
    table-layout: auto;
  }

  body:has(.mobile-bottom-nav) .responsive-table thead {
    display: none;
  }

  body:has(.mobile-bottom-nav) .responsive-table td {
    min-height: 36px;
    display: grid;
    grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr);
    gap: .55rem;
    align-items: center;
    padding: .3rem 0;
    border: 0;
  }

  body:has(.mobile-bottom-nav) .responsive-table td::before {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    content: attr(data-label);
  }

  body:has(.mobile-bottom-nav) :where(.compact-list__head, .compact-job-list__head) {
    display: none;
  }

  body:has(.mobile-bottom-nav) :where(.driver-compact-row > summary, .compact-job-row > summary) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem .7rem;
    padding: .6rem;
  }

  body:has(.mobile-bottom-nav) :where(.compact-row__primary, .compact-row__action) {
    grid-column: 1 / -1;
  }

  body:has(.mobile-bottom-nav) .driver-compact-row > summary > span[data-label]::before,
  body:has(.mobile-bottom-nav) .compact-job-row > summary > span[data-label]::before {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    content: attr(data-label) ": ";
  }

  body:has(.mobile-bottom-nav) .compact-row__details {
    grid-template-columns: minmax(0, 1fr);
  }

	body:has(.mobile-bottom-nav) :where(.planning-selection, form[data-sticky-actions] > .form-actions, form[data-sticky-actions] > * > .form-actions:last-child, .route-sticky-navigation) {
		scroll-margin-block-end: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + .75rem);
	}

  .toast-region,
  .toast-stack {
    inset: calc(var(--mobile-header-offset) + .5rem) var(--mobile-gutter) auto;
    width: auto;
  }

  .scroll-top {
    inset-inline-end: var(--mobile-gutter);
    inset-block-end: calc(var(--mobile-sticky-bottom) + .65rem);
  }

  /* Dashboard: role-specific mobile projection followed by supporting context. */
  .dashboard-page[data-dashboard-role="admin"]:has(> .admin-tour) > .dashboard-intro {
    display: contents;
  }

  .dashboard-page[data-dashboard-role="admin"]:has(> .admin-tour) > .dashboard-intro > .action-row,
  .dashboard-page[data-dashboard-role="admin"]:has(> .admin-tour) > .dashboard-control-bar {
    display: none;
  }

  .dashboard-page[data-dashboard-role="admin"]:has(> .admin-tour) > .dashboard-intro h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .dashboard-page[data-dashboard-role="admin"] {
    padding-top: .25rem;
  }

  .dashboard-metrics {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(7.25rem, 1fr);
    gap: 0;
  }

  .metric-card {
    min-height: 3.4rem;
    padding: .35rem .55rem;
    border-radius: 0;
    contain: inline-size;
  }

  .metric-card strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 1.2rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-columns {
    gap: var(--mobile-section-gap);
  }

  .dashboard-page[data-dashboard-role="driver"] .dashboard-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-side {
    position: static;
  }

  .dashboard-panel {
    padding: .8rem;
    border-radius: var(--mobile-card-radius);
  }

  .dashboard-appointment {
    padding: .7rem 0;
  }

  .dashboard-appointment .action-row,
  .dashboard-attention .action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  /* Concept 88, Touren-Kamm: role-specific chronological phone projections. */
  .dashboard-page[data-dashboard-role="driver"] [data-dashboard-projection="resource-groups"] {
    display: none;
  }

  .dashboard-page[data-dashboard-role="driver"] [data-dashboard-projection="driver-tour"] {
    display: grid;
    gap: .65rem;
    min-width: 0;
  }

  .dashboard-page[data-dashboard-role="driver"] > .dashboard-intro {
    display: contents;
  }

  .dashboard-page[data-dashboard-role="driver"] > .dashboard-intro h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .dashboard-page[data-dashboard-role="driver"] > .dashboard-intro .action-row,
  .dashboard-page[data-dashboard-role="driver"] > .dashboard-columns > .dashboard-side {
    display: none;
  }

  .driver-mobile-availability {
    display: grid;
    gap: .55rem;
    padding: .8rem;
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
    box-shadow: 0 .35rem 1rem rgb(29 40 31 / 6%);
  }

  .driver-mobile-availability .section-heading,
  .driver-mobile-availability .availability-row {
    margin: 0;
  }

  .dashboard-page[data-dashboard-role="admin"] [data-dashboard-projection="resource-groups"] {
    display: none;
  }

  .dashboard-page[data-dashboard-role="admin"] [data-dashboard-projection="admin-tour"] {
    display: grid;
    gap: .5rem;
    min-width: 0;
    padding-bottom: .15rem;
  }

  .driver-tour__heading,
  .admin-tour__heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: .45rem;
    margin-bottom: 0;
  }

  .driver-tour__heading {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .driver-tour__quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }

  .driver-tour__quick-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    justify-content: center;
  }

  .driver-tour__heading h2,
  .driver-tour__heading p,
  .admin-tour__heading h2,
  .admin-tour__heading p {
    margin: 0;
  }

  .driver-tour__heading p:last-child,
  .admin-tour__heading p:last-child {
    margin-top: .2rem;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.35;
  }

  .driver-tour__route,
  .driver-tour__availability,
  .admin-tour__calendar {
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    justify-content: center;
    white-space: nowrap;
  }

  .admin-tour__date-nav {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px minmax(4.5rem, auto);
    align-items: stretch;
    gap: .3rem;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
  }

  .admin-tour__date-nav > .button {
    width: 100%;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: .45rem;
    justify-content: center;
  }

  .admin-tour__date-nav > div {
    min-width: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: .1rem;
    text-align: center;
  }

  .admin-tour__date-nav strong {
    font: 800 clamp(.9rem, 4vw, 1.1rem)/1.05 Aptos, "Segoe UI", sans-serif;
  }

  .admin-tour__date-nav small {
    display: none;
  }

  .admin-tour__today {
    grid-column: auto;
  }

  .admin-tour__commands {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
  }

  .admin-tour__mode,
  .admin-tour__tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
  }

  .admin-tour__mode .button,
  .admin-tour__tools .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: .4rem .3rem;
    justify-content: center;
    font-size: .78rem;
    line-height: 1.15;
    text-align: center;
  }

  .admin-tour .empty-state {
    padding: .6rem .7rem;
  }

  .admin-tour .empty-state :where(h3, p) {
    margin-block: .15rem;
  }

  .admin-tour .empty-state .button {
    margin-top: .35rem;
  }

  /* Admin pages share one compact mobile workbench language. */
  body:has(.site-header[data-actor-role="admin"]) .page-heading {
    gap: .4rem;
    margin-bottom: .5rem;
    padding: .35rem .5rem .45rem;
    border: 0;
    border-block-end: 1px solid var(--line);
    border-inline-start: .3rem solid var(--moss);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body:has(.site-header[data-actor-role="admin"]) .page-heading h1 {
    font-size: clamp(1.4rem, 6.5vw, 1.75rem);
    line-height: 1.05;
  }

  body:has(.site-header[data-actor-role="admin"]) .page-heading p:not(.eyebrow) {
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.3;
  }

  body:has(.site-header[data-actor-role="admin"]) :where(.compact-row, .user-card, .voice-recording-card, .route-location-card, .suggestion-card, .parallel-route-card) {
    border-inline-start: .3rem solid var(--moss);
  }

  body:has(.site-header[data-actor-role="admin"]) .table-card .responsive-table tr {
    border-inline-start: .3rem solid var(--moss);
  }

  body:has(.site-header[data-actor-role="admin"]) :where(.section-heading, .job-card__heading) {
    align-items: start;
  }

  .driver-tour__list,
  .admin-tour__list {
    position: relative;
    isolation: isolate;
    display: grid;
    gap: .65rem;
    min-width: 0;
    margin: 0;
    padding: .2rem 0 .2rem 2.4rem;
    list-style: none;
  }

  .driver-tour__list::before,
  .admin-tour__list::before {
    position: absolute;
    z-index: 0;
    inset-block: .3rem;
    inset-inline-start: .65rem;
    width: .5rem;
    border-radius: 999px;
    background: var(--moss);
    content: "";
  }

  .driver-tour__item,
  .admin-tour__item {
    position: relative;
    z-index: 1;
    min-width: 0;
  }

  .driver-tour__item::before,
  .admin-tour__item::before {
    position: absolute;
    z-index: -1;
    top: 1.45rem;
    inset-inline-end: 100%;
    width: 1.25rem;
    height: .28rem;
    background: var(--moss);
    content: "";
  }

  .driver-tour__appointment,
  .admin-tour__appointment {
    display: grid;
    grid-template-columns: 4.25rem minmax(0, 1fr);
    gap: .6rem;
    min-width: 0;
    min-height: 58px;
    padding: .72rem;
    border: 1px solid var(--line);
    border-inline-start: 0;
    border-radius: 0 var(--mobile-card-radius) var(--mobile-card-radius) 0;
    background: var(--surface);
    box-shadow: 0 .35rem 1rem rgb(29 40 31 / 6%);
  }

  .driver-tour__route-status {
	margin: -.1rem 0 .65rem;
	color: var(--muted);
	font-size: .88rem;
  }

  .driver-tour__appointment:has(.dashboard-countdown--soon),
  .admin-tour__appointment:has(.dashboard-countdown--soon) {
    border-color: var(--ochre);
    box-shadow: 0 0 0 2px var(--ochre), 0 .35rem 1rem rgb(29 40 31 / 8%);
  }

  .driver-tour__time,
  .admin-tour__time {
    display: grid;
    align-content: start;
    justify-items: start;
    gap: .12rem;
    min-width: 0;
    font-variant-numeric: tabular-nums;
  }

  .driver-tour__stop,
  .admin-tour__stop {
    min-width: 1.5rem;
    min-height: 1.5rem;
    display: inline-grid;
    margin-bottom: .18rem;
    place-items: center;
    border-radius: 999px;
    color: var(--moss);
    background: var(--moss-light);
    font-size: .72rem;
    font-weight: 900;
  }

  .driver-tour__time time,
  .admin-tour__time time {
    color: var(--ink);
    font: 800 1.18rem/1 Georgia, "Times New Roman", serif;
  }

  .driver-tour__time small,
  .admin-tour__time small {
    color: var(--muted);
    font-size: .7rem;
    line-height: 1.25;
  }

  .driver-tour__body,
  .admin-tour__body {
    min-width: 0;
  }

  .driver-tour__body h3,
  .admin-tour__body h3 {
    margin: .38rem 0 .22rem;
    font-size: 1.08rem;
    line-height: 1.15;
  }

  .driver-tour__body p,
  .admin-tour__body p {
    margin: .25rem 0;
    font-size: .86rem;
    line-height: 1.35;
  }

  .driver-tour__crew,
  .admin-tour__assignment {
    display: grid;
    gap: .08rem;
    color: var(--muted);
  }

  .driver-tour__crew strong,
  .admin-tour__assignment strong {
    color: var(--ink);
    font-weight: 750;
  }

  .admin-tour__job-number {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
  }

  .admin-tour__appointment:has(.warning-copy) {
    border-color: var(--ochre);
  }

  .driver-tour__actions,
  .admin-tour__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .42rem;
    margin-top: .6rem;
  }

  .driver-tour__actions .button,
  .admin-tour__actions .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: .5rem;
    justify-content: center;
    font-size: .79rem;
    line-height: 1.2;
    text-align: center;
  }

  .driver-tour__navigate {
    grid-column: 1 / -1;
  }

  .route-page .route-stop-contact-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }

  .route-page .route-stop-contact-actions [data-route-navigation],
  .route-page .route-stop-contact-actions [data-route-call] {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    justify-content: center;
  }

  .admin-tour__appointment-link {
    grid-column: 1 / -1;
  }

  .admin-tour__note {
    grid-column: 1 / -1;
  }

  /* Calendar: controls remain reachable while the board becomes a phone card. */
  .calendar-page .calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--mobile-section-gap);
  }

  body:has(.site-header[data-actor-role="admin"]) .calendar-page .calendar-quick-controls {
    position: static;
    background: transparent;
    box-shadow: none;
  }

  .calendar-page .calendar-waitlist {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .calendar-waitlist > summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .45rem .65rem;
    color: var(--moss);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
  }

  .calendar-waitlist > summary::-webkit-details-marker {
    display: none;
  }

  .calendar-waitlist > summary::after {
    content: "+";
  }

  .calendar-waitlist[open] > summary::after {
    content: "−";
  }

  .calendar-waitlist > summary small {
    margin-inline-start: auto;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
  }

  .calendar-waitlist__body {
    max-height: min(22rem, 45dvh);
    padding: 0 .4rem .4rem;
    border-top: 1px solid var(--line);
    overflow: auto;
    overscroll-behavior: contain;
  }

  .calendar-page .calendar-board,
  .calendar-page .calendar-agenda {
    padding: .4rem;
  }

  body:has(.mobile-bottom-nav) .calendar-page .page-heading {
    min-height: 52px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  body:has(.mobile-bottom-nav) .calendar-page .page-heading p {
    display: none;
  }

  body:has(.mobile-bottom-nav) .calendar-page .page-heading h1 {
    margin: 0;
  }

  body:has(.site-header[data-actor-role="driver"]) .calendar-page .page-heading {
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-heading-actions {
    min-width: 0;
    justify-content: flex-end;
  }

  body:has(.site-header[data-actor-role="driver"]) .calendar-heading-actions {
    justify-content: flex-start;
  }

  .calendar-read-only-full {
    display: none;
  }

  .calendar-read-only-compact {
    display: inline;
  }

  .calendar-feed-button {
    min-height: 44px;
    padding-inline: .6rem;
  }

  .calendar-options {
    margin: 0 0 .35rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: .55rem;
    background: var(--surface);
  }

  .calendar-options > summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .45rem .65rem;
    color: var(--moss);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
  }

  .calendar-options > summary::-webkit-details-marker {
    display: none;
  }

  .calendar-options > summary::after {
    content: "+";
    font-size: 1.15rem;
    line-height: 1;
  }

  .calendar-options[open] > summary::after {
    content: "−";
  }

  .calendar-options:not([open]) > .calendar-quick-controls {
    display: none;
  }

  .calendar-quick-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: .4rem;
    margin: 0;
    padding: .4rem;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
  }

  .calendar-control-group,
  .calendar-control-group--date,
  .calendar-control-group--utilities {
    width: 100%;
    grid-column: auto;
    justify-content: stretch;
  }

  .calendar-control-group:not(.calendar-control-group--date):not(.calendar-control-group--utilities) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-control-group--date {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .calendar-control-group--date > label:not(.check-label) {
    min-width: 0;
  }

  .calendar-control-group--utilities {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-control-group .button {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding-inline: .35rem;
    white-space: normal;
  }

  .calendar-page .calendar-range-summary {
    min-height: 1.35rem;
    flex-wrap: nowrap;
    margin: .2rem 0 .15rem;
    overflow: hidden;
    font-size: .74rem;
    white-space: nowrap;
  }

  .calendar-page :where([data-calendar-freshness], [data-calendar-timezone]) {
    display: none;
  }

  .calendar-page .calendar-legend {
	flex-wrap: wrap;
    gap: .65rem;
    margin: 0 0 .25rem;
    padding-block: .1rem;
	overflow-x: visible;
	white-space: normal;
  }

  .calendar-page .calendar-edit-hint {
    display: none;
  }

  .calendar-page [data-calendar] {
    min-height: 28rem;
  }

  .calendar-page .fc .fc-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    gap: .35rem;
  }

  .calendar-page .fc .fc-toolbar-chunk {
    display: flex;
    min-width: 0;
  }

  .calendar-page .fc .fc-toolbar-chunk:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .calendar-page .fc .fc-toolbar-chunk:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
  }

  .calendar-page .fc .fc-toolbar-chunk:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .calendar-page .fc .fc-toolbar-chunk:last-child > .fc-button-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .calendar-page .fc .fc-toolbar-title {
    font-size: clamp(1rem, 5.5vw, 1.35rem);
    line-height: 1.05;
  }

  .calendar-page .calendar-toolbar-button,
  .calendar-page .fc .fc-button {
    min-width: 44px;
    min-height: 44px;
  }

  .agenda-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .55rem;
    padding: .8rem;
  }

  .planning-dialog,
  dialog.modal {
    width: 100vw;
    max-width: none;
    max-height: min(92dvh, var(--visual-viewport-height, 92dvh));
    margin: auto 0 0;
    padding: .9rem var(--mobile-gutter) calc(.9rem + env(safe-area-inset-bottom));
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  }

  /* Planning: progressive steps, full-width map, bottom action sheet. */
  .planning-progress {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
    gap: .3rem;
    padding-bottom: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .planning-progress > li {
    min-width: 0;
    flex: none;
  }

  .planning-progress li > :where(a, span) {
    min-height: 44px;
    flex-direction: column;
    justify-content: center;
    gap: .1rem;
    padding: .2rem .1rem;
    font-size: .68rem;
    line-height: 1.05;
    text-align: center;
  }

  .planning-progress .planning-progress__number {
    width: 1.3rem;
    height: 1.3rem;
    flex-basis: 1.3rem;
  }

  .planning-results > .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .4rem;
  }

  .planning-results > .section-heading form,
  .planning-results > .section-heading .button {
    width: 100%;
    margin: 0;
  }

  .planning-page .planning-orders,
  .planning-page .planning-map-panel,
  .planning-page .planning-selection {
    width: 100%;
    border-radius: var(--mobile-card-radius);
  }

  .planning-page .planning-order-list {
    max-height: min(42dvh, 22rem);
  }

  .planning-page .planning-map {
    min-height: 18rem;
  }

  .planning-page .planning-selection {
    bottom: var(--mobile-sticky-bottom);
    max-height: min(50dvh, 28rem);
    padding: .8rem;
    border-radius: 1rem 1rem 0 0;
    overscroll-behavior: contain;
  }

  .planning-selection-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .planning-mode-tabs,
  .planning-result-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planning-mode-tabs .button,
  .planning-result-tools .button {
    width: 100%;
    margin: 0;
  }

  /* Routes: next stop, ordered stops and map read as separate app surfaces. */
  .route-page .route-day-filter {
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: end;
  }

  .route-page .route-day-filter .button {
	margin: 0;
  }

  @media (max-width: 400px) {
    .route-page .route-day-filter {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .route-day-shortcuts > summary {
	min-height: 44px;
  }

  .route-day-shortcuts {
	width: 100%;
  }

  .route-day-presets {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	width: 100%;
  }

  .route-day-presets .button {
	min-width: 0;
	margin: 0;
	padding-inline: .45rem;
	white-space: normal;
  }

  .route-page .route-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--mobile-section-gap);
  }

  .route-page .route-map-panel {
    position: static;
    padding: .7rem;
  }

  .route-page .route-map-panel [data-route-map] {
    min-height: 18rem;
  }

  .route-page .route-next-stop,
  .route-page .route-stop-card {
    padding: .8rem;
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
  }

  .route-page .route-next-stop {
    border-width: 2px;
    border-color: var(--moss);
  }

  .route-page .route-summary {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .route-page .route-summary .suggestion-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-page .route-map-toolbar,
  .route-page .route-order-actions,
  .route-page .route-stop-pagination {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-page .route-map-toolbar .button,
  .route-page .route-order-actions .button,
  .route-page .route-stop-pagination .button {
    width: 100%;
    margin: 0;
  }

  .route-page .route-map-toolbar .status-badge {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .route-page .route-sticky-navigation {
    bottom: calc(var(--mobile-sticky-bottom) + .35rem);
  }

  .route-location-picker,
  .route-location-custom {
    padding: .75rem;
  }

  body:has(.site-header[data-actor-role="admin"]) .route-location-settings {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-section-gap);
  }

  body:has(.site-header[data-actor-role="admin"]) .route-location-list {
    order: -1;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
  }

  body:has(.site-header[data-actor-role="admin"]) .route-location-settings__form {
    position: static;
  }

  /* Operations: directory rows and weekdays become compact native lists. */
  [data-operation-page] .compact-list {
    border-radius: var(--mobile-card-radius);
    box-shadow: 0 .35rem 1rem rgb(29 40 31 / 6%);
  }

  [data-operation-page] .compact-row > summary {
    min-height: 58px;
    gap: .4rem .65rem;
    padding: .65rem;
  }

  [data-operation-page] .compact-row__details {
    padding: .7rem;
  }

  [data-operation-page] .availability-weekday {
    margin-bottom: .7rem;
    padding: .7rem;
    border: 1px solid var(--line);
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
  }

  [data-operation-page] .availability-weekday > .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  [data-operation-page] .availability-weekday > .section-heading form,
  [data-operation-page] .availability-weekday > .section-heading .button {
    width: 100%;
    margin: 0;
  }

  [data-operation-page] .interval-list {
	gap: .45rem;
  }

  [data-operation-page] .availability-preview:not([open]) {
	height: auto;
	min-height: 46px;
	overflow: visible;
  }

  [data-operation-page] .availability-preview:not([open]) > summary {
	height: auto;
	min-height: 44px;
	overflow: visible;
	text-overflow: clip;
	white-space: normal;
  }

  /* Profile and users: one-column account cards with local sticky navigation. */
  .profile-page .profile-hero {
    gap: .7rem;
    margin-bottom: .7rem;
    padding: .85rem;
    border-radius: var(--mobile-card-radius);
  }

  .profile-page .profile-section-nav {
    top: var(--mobile-header-offset);
    margin-inline: calc(-1 * var(--mobile-gutter));
    padding-inline: var(--mobile-gutter);
    border-inline: 0;
    border-radius: 0;
  }

  .profile-page .profile-grid,
  .profile-page .security-checklist,
  .profile-page .security-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: .7rem;
  }

  .profile-page .profile-card {
    padding: .85rem;
  }

  .profile-page .profile-card > header,
  .profile-page .session-row,
  .profile-page .totp-setup {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .profile-page .profile-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: .2rem;
  }

  .users-page .users-heading,
  .users-page .user-card__header {
    align-items: stretch;
    flex-direction: column;
    gap: .65rem;
  }

  .users-page .user-card__header {
    min-height: 0;
    padding: .85rem;
  }

  .users-page .user-card__badges {
    justify-content: flex-start;
  }

  .users-page .user-manage > summary,
  .users-page .user-manage__grid {
    padding-inline: .8rem;
  }

  .users-page .user-manage__grid,
  .users-page .user-manage__details {
    grid-template-columns: minmax(0, 1fr);
  }

  .users-page .create-user-card {
    position: static;
  }

  body:has(.site-header[data-actor-role="admin"]) .users-page .users-heading {
    margin-bottom: .7rem;
    padding: .75rem .8rem;
    border: 1px solid var(--line);
    border-inline-start: .4rem solid var(--moss);
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
  }

  body:has(.site-header[data-actor-role="admin"]) .users-page .users-heading h1 {
    margin-block: .1rem .25rem;
    font-size: clamp(1.45rem, 7vw, 1.95rem);
    line-height: 1.05;
  }

  /* Voice, feeds and notification failures use short, reachable card flows. */
  .voice-capture {
    gap: .7rem;
  }

  .voice-controls,
  .voice-preview .action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voice-controls .button,
  .voice-preview .button {
    width: 100%;
  }

  .voice-level {
    align-items: stretch;
    flex-direction: column;
  }

  .voice-level meter {
    width: 100%;
    min-width: 0;
  }

  .voice-info__body {
    padding: 0 .8rem .8rem;
  }

  .feed-layout,
  .instruction-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: .7rem;
  }

  .feed-card {
    grid-template-columns: minmax(0, 1fr);
    gap: .55rem;
    padding: .8rem 0;
  }

  .feed-card .action-row,
  .feed-card .action-row form {
    width: 100%;
  }

  .feed-card .action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .feed-card .button {
    width: 100%;
    margin: 0;
  }

  .table-card:has(.responsive-table) {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .table-card .responsive-table {
    min-width: 0;
  }

  .table-card .responsive-table tr {
    margin-bottom: .65rem;
    padding: .55rem .7rem;
    border: 1px solid var(--line);
    border-radius: var(--mobile-card-radius);
    background: var(--surface);
    box-shadow: 0 .25rem .75rem rgb(29 40 31 / 5%);
  }

  .table-card .responsive-table td {
    grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .table-card > .action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .4rem;
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .table-card > .action-row .button {
    width: 100%;
    min-width: 0;
    margin: 0;
    justify-content: center;
    text-align: center;
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .responsive-table tr,
  body:has(.site-header[data-actor-role="admin"]) .waitlist-page .waitlist-table tr {
    display: grid;
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .responsive-table td[data-label="Aktion"] {
    order: -1;
    margin-bottom: .35rem;
    padding-bottom: .55rem;
    border-bottom: 1px solid var(--line);
  }

  body:has(.site-header[data-actor-role="admin"]) .waitlist-page .waitlist-table td[data-label="Aktionen"] {
    margin-top: .35rem;
    padding-top: .55rem;
    border-top: 1px solid var(--line);
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .responsive-table td[data-label="Aktion"]::before,
  body:has(.site-header[data-actor-role="admin"]) .waitlist-page .waitlist-table td[data-label="Aktionen"]::before {
    color: var(--moss);
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .responsive-table td {
    grid-template-columns: minmax(0, 1fr);
    gap: .2rem;
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .responsive-table td > br {
    display: none;
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .notification-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .4rem;
  }

  body:has(.site-header[data-actor-role="admin"]) .notifications-page .notification-actions :where(form, .button),
  body:has(.site-header[data-actor-role="admin"]) .waitlist-page .waitlist-table td[data-label="Aktionen"] :where(.table-row-actions, .button) {
    width: 100%;
    margin: 0;
  }

  body:has(.site-header[data-actor-role="admin"]) .appointment-detail-page > .form-card:first-of-type {
    border-inline-start: .4rem solid var(--moss);
  }

  body:has(.site-header[data-actor-role="admin"]) .appointment-detail-page > .form-card:first-of-type > .action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  body:has(.site-header[data-actor-role="admin"]) .appointment-detail-page > .form-card:first-of-type > .action-row .button {
    width: 100%;
    margin: 0;
  }

  /* Remaining authenticated work lists inherit the same phone rhythm. */
  .customer-list-toolbar {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--mobile-control-gap);
    padding: .4rem;
  }

  .customer-list-toolbar > *,
  .customer-list-toolbar .button,
  .waitlist-filter-chips .button,
  .waitlist-regions .button,
  .waitlist-favorites .button {
    max-width: 100%;
  }

  .customer-list-toolbar__search {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--mobile-control-gap);
  }

  .customer-list-toolbar__search > input {
    grid-column: 1;
    grid-row: 1;
  }

  .customer-list-toolbar__search > button[type="submit"] {
    grid-column: 2;
    grid-row: 1;
  }

  .customer-list-toolbar__search > output {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    width: fit-content;
    max-width: 100%;
    padding-inline: .55rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .customer-list-toolbar__search > a {
    grid-column: 2;
    grid-row: 2;
  }

  .customer-list-toolbar > .customer-filter-menu {
    grid-column: 2;
    align-self: end;
  }

  .customer-list-toolbar > .list-sort-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .waitlist-list-toolbar > .list-sort-controls {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .waitlist-list-toolbar > .customer-filter-menu {
    width: 100%;
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .waitlist-list-toolbar > .customer-filter-menu > summary {
    justify-content: center;
  }

  .list-sort-controls label {
    min-width: 0;
    gap: .15rem;
    font-size: .78rem;
  }

  .list-sort-controls :where(select, .button) {
    min-width: 0;
    min-height: 44px;
    padding-inline: .35rem;
  }

  .selection-toolbar {
    top: calc(var(--mobile-header-offset) + .25rem);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .3rem .45rem;
    align-items: center;
    padding: .4rem;
    border-radius: var(--mobile-card-radius);
  }

  .selection-toolbar .button {
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: .35rem .45rem;
    font-size: .78rem;
    line-height: 1.15;
  }

  .selection-toolbar small {
    grid-column: 1 / -1;
    line-height: 1.2;
  }

  .mobile-redundant-primary-action {
    display: none !important;
  }

  .customer-page .customer-name-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .waitlist-page .waitlist-table td a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  body:has(.mobile-bottom-nav) .compact-filter-panel:not([open]) {
    height: 46px;
    overflow: hidden;
  }

  body:has(.mobile-bottom-nav) .compact-filter-panel:not([open]) > summary {
    height: 44px;
    min-height: 44px;
    padding-block: .35rem;
    overflow: hidden;
    text-overflow: ellipsis;
	white-space: nowrap;
  }

  body:has(.mobile-bottom-nav) .availability-preview:not([open]) {
	height: auto;
	min-height: 46px;
	overflow: visible;
  }

  body:has(.mobile-bottom-nav) .availability-preview:not([open]) > summary {
	height: auto;
	min-height: 44px;
	line-height: 1.3;
	overflow: visible;
	text-overflow: clip;
	white-space: normal;
  }

  .appointment-action-group,
  .appointment-detail-list,
  .onboarding-phase {
    border-radius: var(--mobile-card-radius);
  }

  .onboarding-phase {
    margin-top: .8rem;
    padding: .75rem;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 88%, var(--paper));
  }
}

@media (max-width: 520px) {
	.waitlist-work-views {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		overflow: visible;
	}

	.waitlist-work-views > span {
		grid-column: 1 / -1;
	}

	.waitlist-work-views .button {
		width: 100%;
		min-width: 0;
		padding-inline: .35rem;
		line-height: 1.1;
		text-align: center;
		white-space: normal;
	}

  :where(.customer-page, .waitlist-page) .page-heading .eyebrow,
  :where(.customer-page, .waitlist-page) .page-heading p:not(.eyebrow) {
    display: none;
  }

  body:has(.mobile-bottom-nav) .customer-page .page-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  body:has(.mobile-bottom-nav) .customer-page .page-heading > .action-row {
    width: auto;
  }
}

@media (max-width: 459px) {
  .admin-tour__commands {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-upcoming .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: .2rem;
  }

}

@media (max-width: 360px) {
  :root {
    --mobile-gutter: .5rem;
  }

  .mobile-primary-action {
    width: auto;
    padding: .5rem .55rem;
    font-size: .72rem;
  }

  .mobile-bottom-nav .mobile-nav-item__label {
    overflow: visible;
    font-size: .66rem;
    text-overflow: clip;
  }

  .planning-mode-tabs,
  .planning-result-tools,
  .voice-controls,
  .voice-preview .action-row,
  .route-page .route-map-toolbar,
  .route-page .route-order-actions,
  .route-page .route-stop-pagination {
    grid-template-columns: minmax(0, 1fr);
  }

  .planning-selection-metrics,
  .route-page .route-summary .suggestion-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-card .responsive-table td {
    grid-template-columns: minmax(0, 1fr);
  }

  .waitlist-table td {
    overflow-wrap: anywhere;
  }

  .waitlist-table .status-badge {
    display: inline-block;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .mobile-more__dialog {
    max-height: min(calc(100dvh - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 1.25rem), calc(var(--visual-viewport-height, 100dvh) - var(--mobile-nav-height) - env(safe-area-inset-bottom) - 1.25rem));
  }

  .command-palette,
  .shortcut-help {
    max-height: min(88dvh, var(--visual-viewport-height, 88dvh));
  }
}

@media (display-mode: standalone) {
  @media (max-width: 1050px) {
    body:has(.mobile-bottom-nav) .site-header {
      padding-top: max(env(safe-area-inset-top), .25rem);
    }

    .mobile-bottom-nav {
      padding-bottom: max(env(safe-area-inset-bottom), .25rem);
    }
  }
}

@media print {
  .mobile-app-bar,
  .mobile-bottom-nav,
  .mobile-primary-action,
  .driver-tour,
  .admin-tour {
    display: none !important;
  }

  .dashboard-today--grouped {
    display: block !important;
  }

  .dashboard-page[data-dashboard-role="admin"] > .dashboard-intro,
  .dashboard-page[data-dashboard-role="admin"] > .dashboard-control-bar {
    display: grid !important;
  }

  .dashboard-page[data-dashboard-role="admin"] > .dashboard-intro > div > :not(h1) {
    display: block !important;
  }

  .dashboard-page[data-dashboard-role="admin"] > .dashboard-intro > .action-row {
    display: flex !important;
  }

  .dashboard-page[data-dashboard-role="admin"] > .dashboard-intro h1 {
    position: static;
    width: auto;
    height: auto;
    padding: initial;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: 0;
  }
}
