/* The phone shell shares the employee workbench routes and controls. */
@media screen and (max-width: 760px), screen and (max-width: 1000px) and (max-height: 540px) and (orientation: landscape) {
  html[data-workspace-theme] body.workspace-unified.mw-enabled {
    --pwa-header-height: calc(58px + env(safe-area-inset-top, 0px));
    --mw-bottom: calc(77px + env(safe-area-inset-bottom, 0px));
    --mw-ink: var(--pwa-ink);
    --mw-line: var(--pwa-line);
    --mw-green: var(--pwa-accent);
    color-scheme: var(--pwa-color-scheme);
    background: var(--pwa-bg);
    color: var(--pwa-ink);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.app-shell, .main-wrap, .content) {
    background: var(--pwa-bg);
    color: var(--pwa-ink);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled:not(.touch-fullscreen) .main-wrap {
    width: 100%;
    margin-inline: 0;
    padding-bottom: 0;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled[data-workspace-page="overview"] .workflow-global-host:has(.workflow-strip:not(.has-messages)) {
    display: none;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled[data-workspace-page="overview"] #page-content > .workflow-global-host {
    order: -8;
    margin: 0;
    padding: 0;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled[data-workspace-page="overview"] .workflow-global-host .workflow-strip {
    border-radius: 18px;
    background: var(--pwa-surface);
    border-color: var(--pwa-line);
    color: var(--pwa-ink);
  }

  html[data-workspace-theme="dark"] body.workspace-unified.mw-enabled[data-workspace-page="overview"] .workflow-global-host .workflow-strip {
    background: var(--pwa-surface) !important;
    border-color: var(--pwa-line) !important;
  }

  html[data-workspace-theme="dark"] body.workspace-unified.mw-enabled[data-workspace-page="overview"] .workflow-global-host .workflow-keyword {
    background: var(--pwa-well);
    border-color: var(--pwa-line);
    color: var(--pwa-ink) !important;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled[data-workspace-page="overview"] .daily-production-card .daily-production-header {
    background: transparent;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled[data-workspace-page="overview"] .content > .demo-banner {
    border-radius: 12px;
    margin-block-end: 14px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .workspace-return-bar {
    color: var(--pwa-muted);
    margin-block-end: 8px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .workspace-return-bar button {
    min-height: 44px;
    border-color: var(--pwa-line);
    border-radius: 14px;
    background: var(--pwa-surface);
    color: var(--pwa-accent);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled:not(.touch-fullscreen):not(.is-im-page) .content {
    padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(var(--mw-bottom) + 20px);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled:not(.touch-fullscreen) .topbar {
    height: var(--pwa-header-height);
    min-height: var(--pwa-header-height);
    padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    gap: 8px;
    background: var(--pwa-bg);
    border-bottom: 1px solid var(--pwa-line);
  }

  /* The shared desktop dark stylesheet marks this header as important. */
  html[data-workspace-theme="dark"] body.workspace-unified.mw-enabled:not(.touch-fullscreen) .topbar {
    background: var(--pwa-bg) !important;
    border-color: var(--pwa-line) !important;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .topbar > .workspace-return-bar {
    flex: 0 0 auto;
    gap: 0;
    margin: 0;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .topbar > .workspace-return-bar :is(.workspace-return-target, .workspace-swipe-hint, button > span) {
    display: none;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .topbar > .workspace-return-bar button {
    width: 44px;
    min-width: 44px;
    padding: 0;
    color: var(--pwa-ink);
    font-size: 21px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-topbar-brand img {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border: 1px solid var(--pwa-line);
    border-radius: 10px;
    clip-path: none;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-topbar-brand strong {
    overflow: hidden;
    color: var(--pwa-ink);
    font-size: 15px;
    letter-spacing: 0;
    text-overflow: ellipsis;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-topbar-brand span {
    color: var(--pwa-muted);
    font-size: 10px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .topbar-actions {
    gap: 5px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.gs-mobile-toggle, .mw-message-trigger) {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--pwa-line);
    border-radius: 15px;
    background: var(--pwa-surface);
    color: var(--pwa-ink);
  }

  html[data-workspace-theme="dark"] body.workspace-unified.mw-enabled .topbar-actions .unified-theme-button {
    color: var(--pwa-ink) !important;
    background: var(--pwa-surface) !important;
    border-color: var(--pwa-line) !important;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .gs-mobile-toggle svg {
    stroke: currentColor;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .global-search.is-expanded .gs-field {
    top: calc(var(--pwa-header-height) + 8px);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.global-search.is-expanded .gs-field, .gs-panel) {
    left: max(14px, env(safe-area-inset-left, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .gs-panel {
    top: calc(var(--pwa-header-height) + 64px);
    max-height: calc(100dvh - var(--pwa-header-height) - 80px);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-home-assistant {
    display: grid;
    flex: 0 0 44px;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--pwa-accent);
    background: var(--pwa-surface);
    border: 1px solid var(--pwa-line);
    border-radius: 15px;
    touch-action: manipulation;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-home-tools:has(.mw-home-assistant) .mw-home-avatar,
  html[data-workspace-theme] body.workspace-unified.mw-enabled[data-workspace-page="overview"]:has(.mw-home-assistant) .egret-assistant .ea-launcher {
    display: none;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-bottom-nav {
    width: auto;
    max-width: 500px;
    height: 60px;
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    margin-inline: auto;
    padding: 4px;
    gap: 3px;
    border: 1px solid var(--pwa-glass-edge);
    border-radius: 999px;
    background: var(--pwa-surface);
    box-shadow: var(--pwa-depth), inset 0 1px 0 var(--pwa-glass-edge), inset 0 -1px 1px var(--pwa-glass-rim);
  }

  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-bottom-nav {
      background: var(--pwa-glass-light), var(--pwa-glass);
      -webkit-backdrop-filter: blur(22px) saturate(1.14);
      backdrop-filter: blur(22px) saturate(1.14);
    }
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-bottom-item {
    min-height: 44px;
    max-width: none;
    border-radius: 999px;
    padding: 3px 2px;
    gap: 2px;
    color: var(--pwa-muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-bottom-item.is-current {
    background: var(--pwa-selected);
    color: var(--pwa-accent);
    font-weight: 700;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-bottom-item .mw-icon {
    width: 21px;
    height: 21px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-bottom-item .nav-count, .mw-message-badge) {
    border-color: var(--pwa-surface);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-menu-sheet {
    border-color: var(--pwa-line);
    border-radius: 28px 28px 0 0;
    background: var(--pwa-bg);
    color: var(--pwa-ink);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-sheet-header, .mw-menu-search, .mw-menu-scroll) {
    padding-inline: max(18px, env(safe-area-inset-left, 0px)) max(18px, env(safe-area-inset-right, 0px));
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-sheet-handle {
    background: var(--pwa-line);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-sheet-header h2 {
    color: var(--pwa-ink);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-sheet-header > div > span, .mw-menu-group h3, .mw-menu-result, .mw-sheet-account small) {
    color: var(--pwa-muted);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-sheet-header > button, .mw-menu-search > label, .mw-menu-item, .mw-sheet-account) {
    border-color: var(--pwa-line);
    background: var(--pwa-surface);
    color: var(--pwa-ink);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-sheet-account strong, .mw-menu-search input) {
    color: var(--pwa-ink);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-menu-item-icon, .mw-menu-search > label > button, .mw-sheet-account > button) {
    border-color: var(--pwa-line);
    background: var(--pwa-well);
    color: var(--pwa-accent);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-menu-item {
    border-radius: 18px;
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-menu-item.is-current {
    border-color: var(--pwa-accent);
    background: var(--pwa-selected);
    color: var(--pwa-accent);
  }

  html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-bottom-item, .mw-menu-sheet button, .mw-message-trigger, .mw-home-assistant):focus-visible {
    outline: 2px solid var(--pwa-focus);
    outline-offset: 2px;
  }

  @media (max-width: 350px) {
    html[data-workspace-theme] body.workspace-unified.mw-enabled .topbar:has(.workspace-return-bar:not([hidden])) .mw-topbar-brand > div {
      display: none;
    }
  }

  @supports (corner-shape: squircle) {
    html[data-workspace-theme] body.workspace-unified.mw-enabled :is(.mw-topbar-brand img, .gs-mobile-toggle, .mw-message-trigger, .mw-menu-item, .mw-menu-sheet) {
      corner-shape: squircle;
    }
  }

  @media (prefers-reduced-transparency: reduce), (forced-colors: active) {
    html[data-workspace-theme] body.workspace-unified.mw-enabled .mw-bottom-nav {
      background: var(--pwa-surface);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
      border-color: var(--pwa-line);
    }
  }
}

@media screen and (max-width: 760px), screen and (max-width: 1000px) and (max-height: 540px) and (orientation: landscape) {
  .mw-enabled .pwa-push-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-block: 14px;
    padding: 15px 16px;
    border: 1px solid var(--pwa-line);
    border-radius: 22px;
    background: var(--pwa-glass-light), var(--pwa-surface);
    color: var(--pwa-ink);
  }

  @supports (corner-shape: squircle) {
    .mw-enabled .pwa-push-panel { corner-shape: squircle; border-radius: 28px; }
  }

  .mw-enabled .pwa-push-panel h3 { margin: 0; font-size: 16px; }
  .mw-enabled .pwa-push-panel p { margin: 4px 0 0; color: var(--pwa-muted); line-height: 1.5; font-size: 13px; }
  .mw-enabled .pwa-push-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .mw-enabled .pwa-push-actions button {
    min-height: 44px;
    padding-inline: 14px;
    border: 1px solid var(--pwa-line);
    border-radius: 999px;
    background: var(--pwa-well);
    color: var(--pwa-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 650;
  }
  .mw-enabled .pwa-push-actions button[data-pwa-push-primary] {
    border-color: transparent;
    background: var(--pwa-action);
    color: var(--pwa-action-ink);
  }
  .mw-enabled .pwa-push-actions button:focus-visible { outline: 2px solid var(--pwa-focus); outline-offset: 2px; }
  .mw-enabled .pwa-push-actions button:disabled { opacity: .58; }
}
