/* Settings → Organization, Division and Team: the cards-and-lists look. Loaded after console.css and its siblings and
   scoped to the three Settings levels (.cx-org, which the Division pages also carry, and .cx-team), so Your profile
   keeps the older Console look. Divisions and teams are cards you open; people and settings are lists you read.
   Theme tokens only (--c-*), so every theme recolors it. */

.cx:is(.cx-org, .cx-team) {
  --cx-r: 10px;
  --sx-panel: color-mix(in srgb, var(--c-surface) 82%, var(--c-bg));
  --sx-raise: color-mix(in srgb, var(--c-surface-2) 80%, var(--c-surface));
  --sx-on: color-mix(in srgb, var(--c-accent) 20%, var(--c-surface-2));
  max-width: 1180px;
  margin: 0 auto;
  font-size: 15px;
}

/* ---- Head: one quiet level line, the name, then the level's few tabs as a pill row ---- */
.cx:is(.cx-org, .cx-team) .cx-head { padding: 8px 0 0; border-bottom: 0; margin-bottom: 24px; }
.cx:is(.cx-org, .cx-team) .cx-crumbs { gap: 8px; margin: 0 0 6px; color: var(--c-ink-3); font-size: 14px; font-weight: 600; }
.cx:is(.cx-org, .cx-team) .cx-crumbs a { display: inline; min-width: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--c-btn, var(--c-accent)); line-height: inherit; }
.cx:is(.cx-org, .cx-team) .cx-crumbs a:hover { text-decoration: underline; }
/* A long name ends in "…" on one line rather than wrapping over the next crumb (level-bar.tsx gives the full name as its title). */
.cx:is(.cx-org, .cx-team) .cx-crumbs .cx-crumb-name { display: inline-block; max-width: min(260px, 60vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cx:is(.cx-org, .cx-team) .cx-crumbs .cx-levels-sep { font-size: 14px; }
/* The level each crumb is (Organization, Division), quiet and small before its name: the names alone are often the same. */
.cx-crumb-lvl { margin-right: -3px; color: var(--c-ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
/* The level line already says which level this is, so the colored word above the title is not repeated. */
.cx:is(.cx-org, .cx-team) .cx-crumbs ~ .cx-titlerow .cx-kicker { display: none; }
.cx:is(.cx-org, .cx-team) .cx-title { font: 800 34px/1.1 var(--font-display); }
.cx:is(.cx-org, .cx-team) .cx-titlerow { align-items: flex-end; }
.cx:is(.cx-org, .cx-team) .cx-facts { display: none; }
.cx:is(.cx-org, .cx-team) .cx-tabs { display: inline-flex; gap: 4px; max-width: 100%; margin-top: 20px; padding: 4px; border-radius: 14px; background: var(--sx-panel); }
.cx:is(.cx-org, .cx-team) .cx-tabs a { height: 44px; padding: 0 18px; border: 0; border-radius: 10px; color: var(--c-ink-2); font-size: 15px; }
.cx:is(.cx-org, .cx-team) .cx-tabs a:hover { color: var(--c-ink); }
.cx:is(.cx-org, .cx-team) .cx-tabs a[aria-current='page'] { background: var(--sx-on); color: var(--c-ink); }
.cx:is(.cx-org, .cx-team) .cx-tabs .cx-n { font: 500 14px var(--font-body); color: var(--c-ink-3); }
.cx:is(.cx-org, .cx-team) .cx-tabs .cx-n.is-warn { padding: 1px 7px; border-radius: 999px; color: #0b0e17; font-size: 12px; font-weight: 700; }

/* ---- Controls: taller, rounder, easier to hit ---- */
.cx:is(.cx-org, .cx-team) .cx-btn { height: 40px; padding: 0 16px; border-radius: 10px; font-size: 14px; }
.cx:is(.cx-org, .cx-team) .cx-btn.is-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.cx:is(.cx-org, .cx-team) .cx-head .cx-actions .cx-btn { height: 44px; padding: 0 18px; font-size: 15px; }
.cx:is(.cx-org, .cx-team) .cx-btn.is-accent { font-weight: 700; }
.cx:is(.cx-org, .cx-team) :is(.cx-input, .cx-select) { height: 40px; border-radius: 10px; font-size: 15px; }
.cx:is(.cx-org, .cx-team) .cx-search { height: 40px; }
.cx:is(.cx-org, .cx-team) .cx-seg { border-radius: 10px; }
.cx:is(.cx-org, .cx-team) .cx-seg > :is(a, button, label) { height: 38px; padding: 0 14px; font-size: 14px; }
.cx:is(.cx-org, .cx-team) .cx-label { color: var(--c-ink); font: 700 17px/1.3 var(--font-display); letter-spacing: 0; text-transform: none; }
.cx:is(.cx-org, .cx-team) .cx-field > :is(label, .cx-field-label) { color: var(--c-ink-2); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.cx:is(.cx-org, .cx-team) .cx-help { font-size: 13px; }
.cx:is(.cx-org, .cx-team) .cx-tag { height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; }

/* ---- A tab's content: a soft panel, no colored edge ---- */
.cx:is(.cx-org, .cx-team) .cx-card { border: 0; border-radius: 16px; background: var(--sx-panel); }
.cx:is(.cx-org, .cx-team) .cx-card-head { padding: 20px 24px 16px; }
.cx:is(.cx-org, .cx-team) .cx-card-title { font-size: 20px; }
.cx:is(.cx-org, .cx-team) .cx-card-title em { color: inherit; }
.cx:is(.cx-org, .cx-team) .cx-card-desc { max-width: none; font-size: 14px; }
.cx:is(.cx-org, .cx-team) .cx-card-note { font-size: 13px; }
.cx:is(.cx-org, .cx-team) .cx-card-body { padding: 20px 24px 24px; }
/* A page that draws its own panels (cards of divisions or teams, a list of settings) sits straight on the page. */
.cx:is(.cx-org, .cx-team) .cx-card.is-bare { background: none; border-radius: 0; }
.cx:is(.cx-org, .cx-team) .cx-card.is-bare > .cx-card-body { padding: 0; }

/* ---- Tables read as lists: plain column names, roomy rows, no boxes inside boxes ---- */
.cx:is(.cx-org, .cx-team) .cx-table-wrap { border: 0; border-radius: 12px; background: var(--sx-raise); }
.cx:is(.cx-org, .cx-team) .cx-table { font-size: 15px; }
.cx:is(.cx-org, .cx-team) .cx-table th { padding: 12px 16px; background: none; border-bottom-color: var(--sx-panel); color: var(--c-ink-3); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.cx:is(.cx-org, .cx-team) .cx-table td { height: 56px; padding: 4px 16px; border-bottom-color: var(--sx-panel); }
.cx:is(.cx-org, .cx-team) .cx-table tr.is-add td, .cx:is(.cx-org, .cx-team) .cx-table tr.is-group td { background: none; }
.cx:is(.cx-org, .cx-team) .cx-sub { font-size: 13px; }
.cx:is(.cx-org, .cx-team) .cx-av { width: 36px; height: 36px; border-radius: 50%; font-size: 12.5px; }

/* ---- Cards you open: one per division on the Organization, one per team on a Division ---- */
.sx-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sx-toolbar .cx-input { flex: 1 1 240px; min-width: 0; }
.sx-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.sx-card { position: relative; display: flex; flex-direction: column; gap: 5px; min-height: 96px; padding: 16px 18px; border-radius: 14px; background: var(--sx-panel); color: var(--c-ink); }
.sx-card:hover { background: var(--sx-raise); }
/* The card filter (console-next.js) hides cards with [hidden], which display: flex above would otherwise override. */
.sx-card[hidden] { display: none; }
.sx-card-name { display: flex; align-items: center; gap: 8px; font: 700 16px/1.3 var(--font-display); }
.sx-card-name > a { flex: 1; min-width: 0; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
/* The whole card opens the division or team; the small buttons on it sit above that link. */
.sx-card-name > a::after { content: ''; position: absolute; inset: 0; border-radius: 14px; }
.sx-card-name > a:focus-visible { outline: none; }
.sx-card-name > a:focus-visible::after { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.sx-card :is(button, .sx-card-tools) { position: relative; z-index: 1; }
.sx-card-facts { color: var(--c-ink-2); font-size: 13.5px; }
.sx-card-by { color: var(--c-ink-3); font-size: 13px; }
.sx-card-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; color: var(--c-ink-3); font-size: 13px; }
.sx-flag { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--c-warn) 18%, transparent); color: var(--c-warn); font: 600 12px var(--font-body); white-space: nowrap; }
.sx-flag.is-quiet { background: var(--sx-raise); color: var(--c-ink-2); }
.sx-card.is-add { align-items: stretch; justify-content: center; border: 1px dashed color-mix(in srgb, var(--c-ink) 22%, var(--c-line)); background: none; }
.sx-card.is-add:hover { background: none; }
.sx-card.is-add form { display: flex; flex-direction: column; gap: 8px; }
.sx-card.is-add .cx-btn { align-self: flex-start; }
.sx-card.is-add .cx-btn[aria-busy="true"] { cursor: progress; opacity: .8; }
.sx-busy { margin: 0; color: var(--c-ink-3); font-size: 12.5px; line-height: 1.45; }
.sx-busy[hidden] { display: none; }
.sx-none { padding: 28px 16px; border-radius: 14px; background: var(--sx-panel); color: var(--c-ink-3); text-align: center; }

/* ---- Lists you read: settings (name and what it is on the left, how it is set on the right) and people ---- */
/* Groups sit in two columns where there is room, so a row is never a long empty line; one column below that, in
   their own order (each group carries `order`, and the column wrappers step aside). */
.sx-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; align-items: start; }
.sx-groups.is-one { grid-template-columns: minmax(0, 720px); }
.sx-group { margin: 0 0 28px; }
@media (max-width: 960px) {
  .sx-groups, .sx-groups.is-one { display: flex; flex-direction: column; }
  .sx-groups-col { display: contents; }
}
.sx-group > h2 { margin: 0; font: 700 19px/1.3 var(--font-display); }
.sx-group > p { margin: 4px 0 12px; color: var(--c-ink-2); font-size: 14px; }
.sx-list { border-radius: 16px; background: var(--sx-panel); overflow: hidden; }
.sx-row { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; min-height: 60px; padding: 8px 20px; border-top: 1px solid var(--c-bg); color: var(--c-ink); text-decoration: none; }
.sx-row:first-child { border-top: 0; }
a.sx-row:hover { background: var(--sx-raise); color: var(--c-ink); }
.sx-row-main { flex: 1 1 220px; min-width: 0; }
.sx-row-main b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.sx-row-main small { display: block; margin-top: 2px; color: var(--c-ink-3); font-size: 13.5px; }
.sx-row-now { flex: 0 1 auto; max-width: 46%; color: var(--c-ink-2); font-size: 14px; text-align: right; overflow-wrap: anywhere; }
.sx-chev { flex: none; width: 18px; height: 18px; color: var(--c-ink-3); }
.sx-back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-bottom: 8px; color: var(--c-btn, var(--c-accent)); font-weight: 600; text-decoration: none; }
.sx-back:hover { text-decoration: underline; }

/* People: a list with a few named columns. On a phone the columns stack under the name. */
.sx-people { border-radius: 16px; background: var(--sx-panel); overflow: hidden; }
.sx-people-head, .sx-person { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 2.4fr) minmax(0, 1.5fr); column-gap: 16px; align-items: center; padding: 0 20px; }
.sx-people-head { padding-top: 14px; padding-bottom: 14px; color: var(--c-ink-3); font-size: 13px; font-weight: 600; }
.sx-person { min-height: 60px; padding-top: 6px; padding-bottom: 6px; border-top: 1px solid var(--c-bg); }
.sx-person-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sx-person-who > span:last-child { min-width: 0; }
.sx-person b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.sx-person small { display: block; color: var(--c-ink-3); font-size: 13px; overflow-wrap: anywhere; }
.sx-person-teams { color: var(--c-ink-2); }
.sx-person-role { color: var(--c-ink-2); }
.sx-person-role.is-lead b { color: var(--c-ink); }
.sx-person-role:not(.is-lead) b { font-weight: 400; }
.sx-pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; color: var(--c-ink-2); }
.sx-pager > span { flex: 1; }
.sx-pager .cx-btn[aria-disabled='true'] { opacity: .45; pointer-events: none; }

@media (max-width: 720px) {
  .cx:is(.cx-org, .cx-team) .cx-title { font-size: 28px; }
  .cx:is(.cx-org, .cx-team) .cx-tabs { display: flex; overflow-x: auto; }
  .sx-row { display: grid; grid-template-columns: minmax(0, 1fr) 18px; }
  .sx-row-now { grid-column: 1; max-width: none; text-align: left; }
  .sx-chev { grid-column: 2; grid-row: 1; }
  .sx-row.sx-radio { grid-template-columns: 18px minmax(0, 1fr); }
  .sx-row.sx-radio .sx-row-now { grid-column: 2; }
  .sx-people-head { display: none; }
  .sx-person { grid-template-columns: minmax(0, 1fr); row-gap: 4px; padding-top: 12px; padding-bottom: 12px; }
  .sx-person-teams, .sx-person-role { padding-left: 48px; }
}

/* ---- Team settings in two parts: what this team decides, then what it follows from above ---- */
.sx-part { margin: 32px 0 0; font: 700 19px/1.3 var(--font-display); }
.sx-part:first-child { margin-top: 0; }
.sx-part-help { margin: 4px 0 16px; color: var(--c-ink-2); font-size: 14px; }
.cx:is(.cx-org, .cx-team) .cx-section { grid-template-columns: 220px minmax(0, 1fr); padding: 20px 0; }
.cx:is(.cx-org, .cx-team) .cx-section-l b { font-size: 15px; }
.cx:is(.cx-org, .cx-team) .cx-section-l span { font-size: 13px; }
@media (max-width: 720px) {
  .cx:is(.cx-org, .cx-team) .cx-section { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* ---- Add people (add-people-pages.tsx): three steps on one narrow page ---- */
.cx.sx-narrow:is(.cx-org, .cx-team) { max-width: 760px; }
.sx-steps { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 24px; padding: 4px; border-radius: 14px; background: var(--sx-panel); list-style: none; }
.sx-steps li { flex: 1 1 170px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--c-ink-2); font-weight: 600; }
.sx-steps li > span { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sx-raise); font-size: 13px; font-weight: 700; }
.sx-steps li[aria-current='step'] { background: var(--sx-on); color: var(--c-ink); }
.sx-steps li[aria-current='step'] > span { background: var(--c-btn, var(--c-accent)); color: var(--c-accent-ink); }
.sx-steps li.is-done > span { background: color-mix(in srgb, var(--c-ok) 22%, transparent); color: var(--c-ok); }
.sx-flow fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.sx-flow legend { padding: 0 0 10px; font-weight: 600; }
.sx-panel { display: flex; flex-direction: column; gap: 20px; padding: 28px; border-radius: 16px; background: var(--sx-panel); }
.sx-panel[hidden] { display: none; }
.sx-panel > h2 { margin: 0; font: 700 22px/1.25 var(--font-display); outline: none; }
.sx-panel > h2 + p { margin: -14px 0 0; color: var(--c-ink-2); }
.sx-panel .cx-textarea { min-height: 110px; border-radius: 12px; background: var(--c-bg); font-size: 16px; }
.sx-panel .cx-help.is-bad, .sx-result p.is-bad, .sx-flow-note.is-bad { color: var(--c-danger); }
.sx-pick { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sx-pick.is-one { grid-template-columns: minmax(0, 1fr); }
.sx-pick-divs { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow-y: auto; }
.sx-pick-divs button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--c-ink); font: 500 15px var(--font-body); text-align: left; cursor: pointer; }
.sx-pick-divs button > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sx-pick-divs button > small { color: var(--c-ink-3); font-size: 13px; white-space: nowrap; }
.sx-pick-divs button:hover { background: var(--sx-raise); }
.sx-pick-divs button[aria-pressed='true'] { background: var(--sx-on); font-weight: 600; }
.sx-pick-divs button.has-picked > small { padding: 1px 8px; border-radius: 999px; background: var(--c-btn, var(--c-accent)); color: var(--c-accent-ink); font-weight: 700; }
.sx-pick-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.sx-pick-group[hidden] { display: none; }
/* Which column is which: the divisions on the left, the teams of the one opened on the right. */
.sx-pick-head { margin: 0 0 4px; padding: 0 12px; color: var(--c-ink-3); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sx-pick-group .sx-pick-head { grid-column: 1 / -1; padding: 0 2px; }
.sx-tick, .sx-choice { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border: 1px solid color-mix(in srgb, var(--c-ink) 18%, var(--c-line)); border-radius: 12px; cursor: pointer; }
.sx-tick[hidden] { display: none; }
.sx-tick:has(input:checked), .sx-choice:has(input:checked) { border-color: var(--c-btn, var(--c-accent)); box-shadow: inset 0 0 0 1px var(--c-btn, var(--c-accent)); background: var(--sx-raise); }
.sx-tick input, .sx-choice input[type='radio'], .sx-radio input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--c-btn, var(--c-accent)); }
.sx-tick b, .sx-choice b { display: block; font-weight: 600; }
.sx-tick small, .sx-choice small { display: block; margin-top: 2px; color: var(--c-ink-2); font-size: 13px; }
.sx-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.sx-choice .cx-input { margin-top: 8px; width: 100%; }
.sx-flow .sx-list { background: var(--sx-raise); }
.sx-radio { cursor: pointer; }
.sx-radio .sx-row-now { font-size: 14px; }
.sx-chosen { margin: 0; padding-top: 16px; border-top: 1px solid var(--c-line); color: var(--c-ink-2); }
.sx-summary { margin: 20px 0 0; padding: 18px 22px; border-radius: 14px; background: var(--sx-raise); line-height: 1.55; }
.sx-results { display: flex; flex-direction: column; gap: 10px; }
.sx-results[hidden] { display: none; }
.sx-result { padding: 16px 20px; border-radius: 14px; background: var(--sx-panel); }
.sx-result b { display: block; overflow-wrap: anywhere; }
.sx-result p { margin: 4px 0 0; color: var(--c-ink-2); font-size: 14px; }
.sx-flow-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.sx-flow-note { flex: 1; color: var(--c-ink-2); text-align: right; }
.cx:is(.cx-org, .cx-team) .sx-flow-foot .cx-btn { height: 44px; padding: 0 20px; font-size: 15px; }
/* Add people, step 1: people already in the organization to tick (public/console-next.js). */
.sx-org-people { display: flex; flex-direction: column; gap: 10px; }
.sx-org-people > .sx-pick-head, label.sx-pick-head { padding: 0 2px; }
.sx-org-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 8px; }
.sx-org-tools .cx-input { height: 44px; border-radius: 12px; background: var(--c-bg); font-size: 16px; }
.sx-org-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--c-ink-2); font-size: 14px; }
.sx-org-bar .is-bad { color: var(--c-danger); }
.sx-org-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 420px; overflow-y: auto; padding: 2px; }
.sx-org-list .sx-tick { min-height: 56px; }
.sx-org-list[aria-busy='true'] { opacity: .55; pointer-events: none; }
.sx-org-list .sx-tick > span { min-width: 0; }
.sx-org-list .sx-tick b, .sx-org-list .sx-tick small { overflow-wrap: anywhere; }
.sx-org-people [data-ap-more] { align-self: flex-start; }
.sx-org-people [data-ap-more][hidden], .sx-org-picked[hidden] { display: none; }
.sx-org-picked ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.sx-org-picked li { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px 2px 2px 12px; border-radius: 999px; background: var(--sx-on); font-size: 14px; }
.sx-org-picked li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-org-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--c-ink-2); font-size: 18px; line-height: 1; cursor: pointer; }
.sx-org-x:hover { background: var(--sx-raise); color: var(--c-ink); }
@media (max-width: 720px) {
  .sx-panel { padding: 20px 16px; }
  .sx-pick { grid-template-columns: minmax(0, 1fr); }
  .sx-pick-divs { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .sx-org-tools { grid-template-columns: minmax(0, 1fr); }
  .sx-org-list { grid-template-columns: minmax(0, 1fr); max-height: 360px; }
  .sx-org-x { width: 40px; height: 40px; }
}
.sx-card-tools .cx-card-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-ink-2); }
