.portal-shell .mobile-control,
.portal-shell .mobile-nav-backdrop {
  display: none;
}

@media (max-width: 700px) {
  body, .portal-shell main { height: 100vh; height: 100dvh; }
  .portal-shell main { margin-left: 0; min-width: 0; }
  .portal-shell .top {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  }
  .portal-shell .top h1 { font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
  .portal-shell .top .eyebrow { font-size: 9px; margin: 0 0 3px; }
  .portal-shell .mobile-control {
    display: grid;
    place-items: center;
    padding: 0;
    width: 44px;
    height: 44px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--brown);
    font-size: 22px;
    cursor: pointer;
  }
  .portal-shell .mobile-control:focus-visible,
  .portal-shell .top-actions button:focus-visible {
    outline: 2px solid #b34e0a;
    outline-offset: 2px;
  }
  .portal-shell .top-actions {
    display: none;
    position: absolute;
    z-index: 2;
    top: calc(100% + 4px);
    right: max(12px, env(safe-area-inset-right));
    width: min(240px, calc(100% - 24px));
    box-sizing: border-box;
    padding: 8px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 28px #43231f2e;
  }
  .portal-shell #mobile-actions-toggle[aria-expanded="true"] + .top-actions { display: grid; gap: 6px; }
  .portal-shell .top-actions .quiet { min-height: 44px; justify-content: center; }
  .portal-shell .top-actions .preview-tag { justify-self: center; margin: 3px; }
  .portal-shell .side {
    left: 0;
    z-index: 42;
    width: min(304px, calc(100% - 36px));
    padding-left: env(safe-area-inset-left);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
    visibility: hidden;
  }
  .portal-shell .side .brand { justify-content: flex-start; padding-right: 60px; }
  .portal-shell .side .brand div { display: block; }
  .portal-shell .side nav { min-height: 0; overscroll-behavior: contain; }
  .portal-shell .side nav button { min-height: 44px; }
  .portal-shell .side .subnav-item { font-size: 13px !important; }
  .portal-shell .mobile-nav-close {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
    background: #ffffff12;
    border-color: #ffffff40;
    color: #fff;
  }
  .portal-shell.mobile-nav-open .side { visibility: visible; }
  .portal-shell.mobile-nav-open .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 41;
    width: 100%;
    border: 0;
    background: #2d21185c;
  }
  .portal-shell #engine { padding-bottom: env(safe-area-inset-bottom); }
  .portal-shell .page { padding: 14px max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .portal-shell .portal-welcome { margin: 10px 0 16px; }
  .portal-shell .workspace-cards { grid-template-columns: 1fr; gap: 12px; }
  .portal-shell .workspace-card { min-height: 0; padding: 16px; }
  .portal-shell .workspace-card .tag { position: static; align-self: flex-start; margin-bottom: 6px; }
  .portal-shell .workspace-symbol { font-size: 25px; margin-bottom: 6px; }
  .portal-shell .workspace-card h2 { font-size: 21px; }
  .portal-shell .workspace-card strong { padding-top: 10px; }
}