/* Phone composition only. Desktop keeps the existing workbench shell. */
.mobile-workbench-header,
.mobile-workbench-nav,
.mobile-workbench-home,
.mobile-workbench-more:not([open]) { display: none; }

@media (max-width: 720px) {
  body.mobile-workbench {
    background: var(--ds-bg-aqua);
    color: var(--ds-ink-strong);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  body.mobile-workbench *, body.mobile-workbench *::before, body.mobile-workbench *::after { box-sizing: border-box; }
  body.mobile-workbench [hidden] { display: none !important; }
  body.mobile-workbench .sidebar,
  body.mobile-workbench .topbar,
  body.mobile-workbench .page-quick-actions,
  body.mobile-workbench .ambient-stage,
  body.mobile-workbench .cursor-field,
  body.mobile-workbench .dashboard-hub { display: none !important; }
  body.mobile-workbench .layout,
  body.mobile-workbench[data-panel="dashboard"] .layout {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
  }
  body.mobile-workbench .content,
  body.mobile-workbench[data-panel="dashboard"] .content {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 16px;
  }
  body.mobile-workbench .content-shell { width: 100%; max-width: 100%; min-width: 0; margin: 0; }
  body.mobile-workbench[data-panel="dashboard"] .content { height: auto; max-height: none; overflow: visible; opacity: 1; pointer-events: auto; transform: none; }
  body.mobile-workbench .panel { max-width: 100%; min-width: 0; }
  body.mobile-workbench .mobile-workbench-header {
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 76px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: var(--ds-sidebar-soft);
    color: var(--ds-surface-clean);
  }
  .mobile-workbench-header img { width: 36px; height: 36px; object-fit: contain; flex: 0 0 auto; }
  .mobile-workbench-header > div { min-width: 0; flex: 1; display: grid; gap: 2px; }
  .mobile-workbench-header strong { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
  .mobile-workbench-header #mobileWorkbenchUser { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-mint); }
  .mobile-workbench-header button { flex: 0 0 auto; background: transparent; border: 1px solid var(--ds-sidebar-line); color: var(--ds-surface-clean); padding: 8px 12px; box-shadow: none; }
  body.mobile-workbench .mobile-workbench-nav {
    display: flex;
    position: fixed;
    z-index: 100;
    left: 0;
    right: 0;
    bottom: 0;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--ds-sidebar-soft);
    border-top: 1px solid var(--ds-sidebar-line);
    box-shadow: 0 -8px 24px rgba(0, 7, 12, .12);
  }
  .mobile-workbench-nav button { flex: 1; min-width: 0; min-height: 54px; display: grid; gap: 2px; place-content: center; text-align: center; color: var(--ds-surface-clean); background: transparent; border: 0; border-radius: 16px; font-size: 12px; padding: 4px; box-shadow: none; }
  .mobile-workbench-nav button > span { font-size: 21px; line-height: 24px; }
  .mobile-workbench-nav button > svg { width: 22px; height: 22px; margin-inline: auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-workbench-nav button[aria-current] { background: var(--ds-accent-soft); color: var(--ds-mint); }
  .mobile-workbench-nav button[aria-current]::before {
    content: "";
    position: absolute;
    inset: 2px 0 auto;
    width: 22px;
    margin-inline: auto;
    border-top: 3px solid currentColor;
    border-radius: var(--ds-radius-pill);
  }
  body.mobile-workbench button,
  body.mobile-workbench .ghost-button,
  body.mobile-workbench .primary-button,
  body.mobile-workbench input:not([type="checkbox"]):not([type="radio"]),
  body.mobile-workbench select { min-height: 44px; }
  body.mobile-workbench input,
  body.mobile-workbench select,
  body.mobile-workbench textarea { font-size: 16px; max-width: 100%; }
  body.mobile-workbench button:focus-visible,
  body.mobile-workbench a:focus-visible { outline: 3px solid var(--ds-accent-strong); outline-offset: 2px; }
  body.mobile-workbench .mobile-workbench-header button:focus-visible {
    outline-color: var(--ds-sky);
    outline-offset: -2px;
  }
  body.mobile-workbench .mobile-workbench-nav button:focus-visible {
    outline: none;
    text-decoration: underline solid var(--ds-sky) 1px;
    text-underline-offset: 4px;
  }
  body.mobile-workbench .mobile-workbench-home { display: grid; gap: 20px; }
  .mobile-home-heading, .mobile-section-heading { display: flex; gap: 12px; justify-content: space-between; align-items: center; min-width: 0; }
  .mobile-home-heading > div { min-width: 0; }
  .mobile-home-heading h2 { font-size: 24px; margin: 0; line-height: 1.3; }
  .mobile-home-heading p { min-height: 18px; margin: 4px 0 0; color: var(--ds-muted); font-size: 12px; }
  .mobile-home-heading button { flex: 0 0 auto; }
  .mobile-home-section { min-width: 0; background: var(--ds-surface-bright); padding: 16px; border-radius: var(--ds-radius-panel); box-shadow: var(--ds-shadow-sm); }
  .mobile-home-section h3 { margin: 0 0 12px; font-size: 18px; }
  .mobile-section-heading h3 { margin-bottom: 0; }
  .mobile-section-heading { margin-bottom: 8px; }
  .mobile-section-heading .ghost-button { padding: 8px; font-size: 13px; }
  .mobile-workbench-home .ghost-button { box-shadow: none; }
  .mobile-home-section form { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .mobile-home-section form input { width: 100%; min-width: 0; flex: 1; }
  .mobile-home-section form button { flex: 0 0 auto; }
  .mobile-home-section form button[type="submit"] {
    background: color-mix(in srgb, var(--ds-brand-blue) 76%, var(--ds-ink-strong));
    color: var(--ds-surface-clean);
    box-shadow: none;
  }
  .mobile-home-section form button[type="submit"]::after { content: none; }
  .mobile-home-row { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; border-radius: 0; border-bottom: 1px solid var(--ds-line-strong); background: transparent; color: var(--ds-ink-strong); padding: 14px 0; text-align: left; box-shadow: none; }
  .mobile-home-row:last-child { border-bottom: 0; padding-bottom: 2px; }
  .mobile-home-row > span:first-child { display: grid; gap: 4px; min-width: 0; flex: 1; }
  .mobile-home-row strong { font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
  .mobile-home-row span span { font-size: 14px; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
  .mobile-home-row small { color: var(--ds-muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
  .mobile-row-arrow { color: var(--ds-accent-strong); font-size: 24px; }
  .mobile-home-status { margin: 14px 0; line-height: 1.6; font-size: 14px; color: var(--ds-muted); }
  .mobile-home-section [data-state="error"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-2) var(--ds-space-4);
  }
  .mobile-home-status.has-error {
    flex: 1 1 9em;
    margin: 0;
    color: color-mix(in srgb, var(--ds-danger) 70%, var(--ds-ink));
  }
  .mobile-workbench-more { width: min(520px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 20px; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-panel); background: var(--ds-surface-bright); color: var(--ds-ink-strong); overflow: auto; overscroll-behavior: contain; }
  .mobile-workbench-more::backdrop { background: rgba(2, 7, 13, .65); }
  .mobile-more-heading { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
  .mobile-more-heading h2 { margin: 0; font-size: 22px; }
  .mobile-more-heading p { margin: 6px 0 14px; overflow-wrap: anywhere; color: var(--ds-muted); font-size: 14px; }
  .mobile-more-heading > div { min-width: 0; }
  .mobile-more-heading > button { flex: 0 0 auto; }
  .mobile-more-modules, .mobile-more-links { display: grid; }
  .mobile-more-links { border-top: 1px solid var(--ds-line-strong); padding-top: 8px; margin-top: 8px; }
  .mobile-more-modules button, .mobile-more-links button, .mobile-more-links a { display: flex; width: 100%; justify-content: space-between; align-items: center; text-align: left; min-height: 48px; padding: 10px 8px; color: var(--ds-ink-strong); background: transparent; border: 0; border-radius: 14px; box-shadow: none; font-size: 16px; text-decoration: none; }
  .mobile-more-modules button:hover, .mobile-more-links button:hover, .mobile-more-links a:hover { background: var(--ds-bg-aqua); }
  body.mobile-workbench .card, body.mobile-workbench .workspace-strip { max-width: 100%; min-width: 0; }
  body.mobile-workbench .split { min-width: 0; }
  body.mobile-workbench .workspace-mode-row { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; flex-wrap: nowrap; }
  body.mobile-workbench .workspace-mode-button { flex: 0 0 auto; }
  body.mobile-workbench .table-wrap, body.mobile-workbench .product-grid-table { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
  body.mobile-workbench #productGridTable input, body.mobile-workbench #productGridTable textarea { font-size: 16px; }
  body.mobile-workbench .modal { padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  body.mobile-workbench .modal-dialog, body.mobile-workbench .manual-dialog { min-width: 0; width: 100%; max-width: 100%; max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; }
  body.mobile-workbench #productDetailDialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); scroll-padding-bottom: 24px; }
  body.mobile-workbench .toast { top: auto; right: 16px; left: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); width: auto; min-width: 0; max-width: calc(100% - 32px); overflow-wrap: anywhere; transform: translateY(8px); }
  body.mobile-workbench .toast.show { transform: translateY(0); }
  body.mobile-workbench .compliance-footer { margin-top: 16px; padding-bottom: 16px; }
  body.mobile-workbench .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  body.auth-pending .mobile-workbench-header, body.auth-required .mobile-workbench-header,
  body.auth-pending .mobile-workbench-nav, body.auth-required .mobile-workbench-nav { display: none !important; }
  .auth-gate input, .auth-gate select, .auth-gate textarea { font-size: 16px; }
  .auth-gate button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-workbench-header *, .mobile-workbench-home *, .mobile-workbench-nav *, .mobile-workbench-more * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (max-width:720px) {
 .mobile-home-pager {display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:12px;}
 .mobile-home-pager span {font-size:13px;color:var(--ds-muted);}
 .mobile-history-queue {border-top:1px solid var(--ds-line-strong);margin-top:12px;}
 .mobile-history-queue>summary {cursor:pointer;padding:12px 0;min-height:44px;font-weight:600;}
}
