/* Production-readiness corrections for the shared Workspace chrome.
   Presentation only: no visibility, pointer, state, or functional selectors. */

.ws5-main,
.ws5-content,
.ws-main {
  min-width: 0;
}

.ws5-railscroll {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.ai-meta,
.ai-chip {
  min-width: 0;
  max-width: 100%;
}

.ws-instruments,
.tiles {
  min-width: 0;
}

.ws-inst,
.tile {
  min-width: 0;
}

.ws-inst .name,
.ws-inst .val.empty,
.tile .l {
  overflow-wrap: anywhere;
}

.lanes,
.lane,
.ai-card,
.ai-main,
.ai-actions.col,
.ai-control,
.ai-cardtools,
.mini-select {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.ai-chip {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

@media (max-width: 860px) {
  .ws5-shell,
  .ws-app {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .ws5-rail {
    display: block !important;
    width: 100%;
    inline-size: 100%;
    min-width: 0;
    max-width: 100%;
    max-inline-size: 100vw;
    box-sizing: border-box;
    contain: inline-size;
    padding: 0;
    overflow: visible;
  }

  .ws5-railscroll {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .ws-rail {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
  }

  .ws5-railscroll::-webkit-scrollbar,
  .ws-rail::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .ws5-main,
  .ws-main,
  .ws5-content {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .ws5-topbar,
  .ws-topbar {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    height: auto;
    min-height: 54px;
    padding: 10px 16px;
    gap: 9px;
  }

  .ws5-crumb,
  .ws-crumb,
  .ws5-topright,
  .ws-topright,
  .ws5-user,
  .ws-user,
  .ws5-who,
  .ws-who {
    min-width: 0;
  }

  .ws5-crumb,
  .ws-crumb {
    width: 100%;
  }

  .ws5-crumb span,
  .ws-crumb span {
    max-width: none;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .ws5-topright {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    width: 100%;
    gap: 10px;
  }

  .ws-topright {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    width: 100%;
    gap: 10px;
  }

  .ws5-user,
  .ws-user {
    align-items: flex-start;
  }

  .ws5-who b,
  .ws5-who span,
  .ws-who b,
  .ws-who span {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .ws5-btn,
  .ws-signout {
    align-self: start;
  }
}

@media (max-width: 560px) {
  .ws-instruments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ws-inst .val.empty {
    font-size: 18px;
    line-height: 1.2;
  }

  /* WebKit includes a select's longest owner option in intrinsic sizing. Give
     the Action board one full-width control per row and reclaim nested padding
     so long real names remain visible without narrowing the action title. */
  body.workspace-actions-surface .content {
    padding-inline: 14px;
  }

  body.workspace-actions-surface .lane {
    padding-inline: 8px;
  }

  body.workspace-actions-surface .ai-card {
    padding-inline: 10px;
  }

  body.workspace-actions-surface .ai-actions.col {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  body.workspace-actions-surface .ai-control,
  body.workspace-actions-surface .ai-cardtools,
  body.workspace-actions-surface .mini-select {
    width: 100%;
  }

  body.workspace-actions-surface .mini-select {
    padding-inline: 6px;
  }
}

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