/* ===== Workspace archetype on a phone · path bar, rail sheet and stacked panel, for every tab that derives from it ===== */

/* a full-bleed tab scrolls with the page on a phone, so the path bar can stick and a long list just runs on */
.tab-panel.is-fullbleed.active,
.tab-panel.is-workspace.active { height: auto; min-height: calc(100dvh - var(--navbar-h) - var(--phone-floor)); overflow: visible; }
.workspace { flex: none; display: flex; flex-direction: column; gap: 0.75rem; }
.workspace-pane { min-width: 0; }


/* ─── Path bar · one sticky row that scrolls sideways instead of wrapping into three ─── */
.pathbar {
  position: sticky;
  top: var(--navbar-h);
  z-index: var(--z-raise-3);
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: calc(-1 * var(--page-inset-y)) calc(-1 * var(--page-inset-x)) 0.6rem;
  padding: 0.45rem var(--page-inset-x);
  background: var(--bg);
}
.pathbar::-webkit-scrollbar { display: none; }
/* an edge with more past it fades out, so a cut segment reads as "swipe for more" rather than as the end */
.pathbar.is-clipped-right { mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
.pathbar.is-clipped-left { mask-image: linear-gradient(to right, transparent, #000 2rem); }
.pathbar.is-clipped-left.is-clipped-right { mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2rem), transparent); }
.pathbar > *,
.pathbar-group > * { flex: none; }
/* every segment is still a select, only sized for a thumb */
.pathbar-select,
.pathbar .crumb,
.pathbar .combo-input,
.pathbar .btn-icon,
.pathbar .btn-primary,
.pathbar .btn-secondary { min-height: 2.5rem; }
.pathbar .btn-icon { min-width: 2.5rem; }
/* the spacer pushed actions to the far edge of a wide bar · in a scrolling row that edge is off screen */
.pathbar-spacer { margin-left: 0.5rem; }


/* ─── Rail · a sheet raised by the path bar's button, in place of the desktop column and its select fallback ─── */
.workspace-rail-fallback { display: none; }
.pathbar-rail-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.workspace-rail { display: none; }
.workspace.is-rail-open > .workspace-rail {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--phone-floor);
  max-height: 70dvh;
  z-index: var(--z-popover);
  border: 0;
  border-radius: 16px 16px 0 0;
  /* the spread shadow is the scrim, the same trick the nav sheet uses */
  box-shadow: 0 0 0 100vmax var(--overlay);
}
.workspace-rail-head { padding: 0.75rem 1rem; font-size: 0.75rem; }
.workspace-rail-body { overflow-y: auto; overscroll-behavior: contain; }
.workspace-row { min-height: var(--touch); }
/* A side panel's fields and buttons are thumb-sized · a checkbox or radio keeps its own size, or it stretches into a bar */
.workspace-panel input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.workspace-panel select,
.workspace-panel .btn-primary,
.workspace-panel .btn-secondary { min-height: var(--touch); }
.workspace-panel input[type="checkbox"],
.workspace-panel input[type="radio"] { width: 20px; height: 20px; }
/* folding and dragging are desktop column controls with no column to act on here */
.workspace-resize,
.workspace .btn-collapse-panel[data-collapse] { display: none; }


/* ─── Side panel · stacked under the list it details, full width ─── */
.workspace-panel { position: static; width: auto; max-height: none; scroll-margin-top: calc(var(--navbar-h) + 3.5rem); }
/* a panel's own close (solid panel, task drawer) is how you put the detail away, so it stays and takes a thumb · expand carries data-phone-hide */
.workspace .btn-collapse-panel:not([data-collapse]) { display: inline-flex; align-items: center; justify-content: center; min-width: var(--touch); min-height: var(--touch); }


/* ─── Landing cards · a section-card landing is one column of big targets ─── */
.card-habitat { max-width: none; padding-top: 0.25rem; }
.card-habitat .card-grid { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; margin-top: 0.25rem; }
.card-habitat .card { min-height: 4.5rem; padding: 0.9rem 1rem; }


/* ─── Tables · cells size to what they hold, undoing legacy mobile.css's 150px per cell for every tab ─── */
.data-table:not(.grid-table) th,
.data-table:not(.grid-table) td { min-width: 0; }


/* ─── Card rows · pass phone_cards to table_shell() and a table reads as a list of cards; the tab only places its cells ─── */

table[data-phone-cards][data-phone-cards] { width: 100% !important; min-width: 0; }  /* the doubled attribute outranks desktop and legacy cell rules, yet any tab rule naming an id outranks it */
table[data-phone-cards][data-phone-cards] > thead { display: none; }
table[data-phone-cards][data-phone-cards] > tbody { display: block; }
table[data-phone-cards][data-phone-cards] > tbody > tr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  min-height: 3.5rem;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}
/* a cell in a card is just a line of text, with none of the table's padding, borders or widths */
table[data-phone-cards][data-phone-cards] > tbody > tr > td { display: block; min-width: 0 !important; width: auto; padding: 0 !important; border: 0; white-space: normal; }
/* the row's actions close the card on a line of their own, each a thumb target */
table[data-phone-cards][data-phone-cards] > tbody > tr > td.col-action { order: 6; flex: 1 1 100%; display: flex; justify-content: flex-end; gap: 0.25rem; }
table[data-phone-cards][data-phone-cards] > tbody > tr > td.col-action:empty { display: none; }
table[data-phone-cards][data-phone-cards] > tbody > tr > td.col-action button { min-width: var(--touch); min-height: var(--touch); }
/* reordering is drag and drop, which a touch screen doesn't do · the handle only takes room */
table[data-phone-cards][data-phone-cards] > tbody > tr > td.col-drag { display: none; }
/* 'lead' · every cell drops to a small facts line, and the tab names the one or two that lead above it */
table[data-phone-cards="lead"][data-phone-cards] > tbody > tr > td:not(.col-action) { order: 4; flex: none; font-size: 0.78rem; color: var(--text-muted); }
/* a zero-height line between the leads (order 1-2) and the facts (order 4+), so the two never share a line */
table[data-phone-cards="lead"][data-phone-cards] > tbody > tr::before { content: ""; order: 3; flex-basis: 100%; height: 0; margin-bottom: -0.3rem; }
