/* Workspaces: header switcher (workspace.rs), role badges, and the
   Workspace page (pages/workspace.rs). Tokens only; menu chrome reuses the
   account menu's .acct__* classes from shell.css. */

/* ---------- Role badge: a word, never colour alone ---------- */
.ws-role {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--radius-pill);
  font: 600 11px/18px var(--font-sans); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
  background: var(--surface-raised); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--border);
}
.ws-role--owner { background: var(--grape-wash); color: var(--ink); box-shadow: inset 0 0 0 1px var(--grape); }
.ws-role--admin { background: var(--warn-wash); color: var(--warn-text); box-shadow: none; }
.ws-role--member { background: var(--patched-wash); color: var(--patched); box-shadow: none; }

/* ---------- Header switcher ---------- */
.ws-switch { position: relative; }
.ws-switch--loading { display: inline-block; width: 120px; height: 34px; border-radius: var(--radius-pill); background: var(--surface-raised); }
.ws-switch__btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2);
  height: 34px; max-width: 280px; padding: 0 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  font: 600 13px/20px var(--font-sans); transition: background-color 120ms ease-out;
}
.ws-switch__btn:hover, .ws-switch__btn[aria-expanded="true"] { background: var(--surface-raised); }
.ws-switch__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ws-switch__icon { color: var(--ink-muted); font-size: 13px; }
.ws-switch__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switch__dot {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); display: inline-grid; place-items: center;
  background: var(--fizz); color: var(--on-fizz); font: 600 11px/1 var(--font-mono);
}
.ws-menu { right: auto; left: 0; width: 320px; }
.ws-menu__label { margin: var(--space-2) var(--space-2) var(--space-1); color: var(--ink-muted); }
.ws-menu__note { margin: 0; padding: var(--space-2); font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }
.ws-menu__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.ws-menu__ws {
  appearance: none; cursor: pointer; width: 100%; display: flex; align-items: center; gap: var(--space-2);
  padding: 8px var(--space-2); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink);
  font: 400 14px/20px var(--font-sans); text-align: left;
}
.ws-menu__ws > i:first-child { width: 16px; text-align: center; color: var(--ink-muted); font-size: 13px; }
.ws-menu__ws:hover { background: var(--surface-raised); }
.ws-menu__ws:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ws-menu__ws[aria-current="true"] { font-weight: 600; }
.ws-menu__wsname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-menu__here { color: var(--grape); font-size: 12px; }
.ws-menu__invites { border-top: 1px solid var(--border); margin-top: var(--space-1); padding-top: var(--space-1); }
.ws-menu__invite { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-2); border-radius: var(--radius-md); background: var(--surface-raised); }
.ws-menu__invtext { font: 400 13px/20px var(--font-sans); color: var(--ink); overflow-wrap: anywhere; }
.ws-menu__by { display: block; color: var(--ink-muted); font-size: 12px; }
.ws-menu__invbtns { display: flex; gap: var(--space-2); }
.ws-menu__new { display: flex; align-items: flex-end; gap: var(--space-2); border-top: 1px solid var(--border); margin-top: var(--space-1); padding: var(--space-2); }
.ws-menu__new .mc-field { flex: 1; }
.ws-menu__new .mc-field input { min-height: 36px; padding: 6px 10px; }

/* ---------- Workspace page ---------- */
.ws-body { margin-top: var(--space-5, 20px); }
.ws-section { display: flex; flex-direction: column; gap: var(--space-4); }
.ws-help { margin: 0; font: 400 14px/22px var(--font-sans); color: var(--ink-muted); }
.ws-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.ws-form .mc-field { min-width: 160px; }
.ws-form__grow { flex: 1 1 240px; }
.ws-select {
  min-height: 36px; padding: 6px 10px; border-radius: var(--radius-md); border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: 400 14px/20px var(--font-sans); cursor: pointer;
}
.mc-field .ws-select { min-height: 44px; width: 100%; }
.ws-select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ws-table .ws-ident { font: 500 13px/20px var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.ws-you, .ws-eff { color: var(--ink-muted); font-size: 12px; }
.ws-actions { text-align: right; white-space: nowrap; }
.ws-teams { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.ws-team { display: flex; flex-direction: column; gap: var(--space-3); }
.ws-team__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.ws-team__head .mc-btn { margin-left: auto; }
.ws-team__name { margin: 0; font: 700 17px/24px var(--font-display); color: var(--ink); }
.ws-team__count { color: var(--ink-muted); font-size: 13px; }
.ws-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ws-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: var(--radius-pill);
  background: var(--surface-raised); border: 1px solid var(--border); font-size: 13px; max-width: 100%;
}
.ws-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-chip__x {
  appearance: none; cursor: pointer; width: 24px; height: 24px; display: grid; place-items: center; border: 0;
  border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted);
}
.ws-chip__x:hover { background: var(--surface); color: var(--ink); }
.ws-chip__x:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ws-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ws-inline .mc-field { flex: 1 1 220px; }
.ws-inline .mc-field input { min-height: 36px; padding: 6px 10px; }
.ws-danger { display: flex; flex-direction: column; gap: var(--space-3); border-color: var(--border-strong); }
.mc-act__actor { font-weight: 600; color: var(--ink); }

@media (max-width: 640px) {
  .ws-switch__name { display: none; }
  .ws-switch__btn { padding: 0 8px; }
  .ws-menu { left: auto; right: -90px; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-switch__btn { transition: none; }
}
