/* Console: Settings → Organization and Division (hierarchy-pages.tsx) and the activity log viewer
   (activity-routes.tsx ActivityCard, also on Team settings). Shared building blocks are in console.css; this file only
   adds what these pages need. Theme tokens only (--c-*), so every theme recolors it. */

/* ---- Small shared bits ---- */
.cx-info { display: inline-block; margin-left: 4px; color: var(--c-ink-3); font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; cursor: help; }
.cx .cx-toolbar .cx-help { min-width: 0; }
.cx-org .cx-label { white-space: nowrap; }
.cx-org .cx-table td.cx-pri { color: var(--c-ink); }
.cx-org .cx-code { font: 500 11.5px var(--font-mono); color: var(--c-ink-3); }
.cx-org .cx-table .is-end .cx-btn + .cx-btn, .cx-org .cx-table .is-end .cx-btn + .cx-help { margin-left: 4px; }
.cx-org .cx-search { height: 30px; }

/* A division row's last cell: the inline Add team form and Open on one line, the same height as the row's text. */
.cx-row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; vertical-align: middle; }
.cx-inline-add { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.cx-inline-add .cx-input { width: 170px; height: 26px; font-size: 12.5px; }
/* Add row inside a table (tr.is-add > td > form): input, a muted note, then the button on the right. */
.cx-addrow { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; padding: 8px 0; }
.cx-addrow > .cx-input { width: 340px; max-width: 100%; }
.cx-table tr.is-add td { height: auto; }
.cx-table tr.is-add:hover td { background: var(--cx-head-bg); }

/* ---- Organization → Divisions ---- */
.cx-org-divs td.cx-org-teams { white-space: nowrap; }
.cx-org-divs .cx-org-date { white-space: nowrap; }
.cx-org-divs th:first-child { width: 22%; }

/* Email domains strip: chips "domain · N people ×" and an inline add. */
.cx-chip { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 4px 0 9px; border: 1px solid var(--cx-line-2); border-radius: 3px; background: var(--c-bg); white-space: nowrap; }
.cx-chip-k { font: 500 12px var(--font-mono); color: var(--c-ink); }
.cx-chip-n { font: 500 11px var(--font-mono); color: var(--c-ink-3); }
.cx-chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 2px; background: none; color: var(--c-ink-3); font-size: 14px; line-height: 1; cursor: pointer; }
.cx-chip-x:hover { color: var(--c-danger); background: color-mix(in srgb, var(--c-danger) 12%, transparent); }
.cx-chip-x:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.cx-chip:not(:has(.cx-chip-x)) { padding-right: 9px; }
.cx-chip-add { display: inline-flex; align-items: center; gap: 6px; }
/* A request to join (Settings → Organization): who is asking, then Approve and Decline. Wraps on a phone. */
.cx-chip-add .cx-input { width: 170px; height: 28px; }
.cx-org-why { flex: 1 1 260px; }

/* Level names: the strip is the <summary>; Rename opens the four fields under it, inside the same box. */
.cx-strip-d { margin-top: 10px; border: 1px solid var(--cx-line); border-radius: var(--cx-r); background: var(--c-surface); }
.cx-strip-d > summary { list-style: none; margin: 0; border: 0; background: none; cursor: pointer; }
.cx-strip-d > summary::-webkit-details-marker { display: none; }
.cx-strip-d > summary:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
.cx-strip-d[open] > summary .cx-btn { background: color-mix(in srgb, var(--c-ink) 8%, transparent); }
.cx-org-labels { color: var(--c-ink); font-weight: 600; font-size: 13px; }
.cx-org-labels i { font-style: normal; color: var(--c-ink-3); margin: 0 4px; }
.cx-names-form { display: flex; align-items: flex-end; gap: 12px 14px; flex-wrap: wrap; padding: 4px 14px 14px; border-top: 1px solid var(--cx-line); }
.cx-names-form .cx-names-grid { flex: 1 1 560px; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 12px; }
.cx-names-form .cx-help { flex-basis: 100%; }

/* ---- Organization → Roles ---- */
.cx-org-person { flex: 0 1 380px; min-width: 220px; }
.cx-org-person .cx-input { width: 100%; }
.cx-org-foot { margin-top: 10px; }
/* The people search list drops below its input; the table box must not clip it (it scrolls sideways on phones only). */
@media (min-width: 901px) { .cx-org-roles { overflow: visible; } }

/* ---- Division → Teams ---- */
.cx-div-default { margin-left: 8px; }
.cx-div-teams col.cx-col-team { width: 26%; }
.cx-div-teams col.cx-col-open { width: 11%; }
/* "Open to" heads its three tickbox columns: one tinted band, the group name over a rule, the platform roles under it. */
.cx-div-teams th.cx-open-group { text-align: center; color: var(--c-accent); border-left: 1px solid var(--cx-line); border-right: 1px solid var(--cx-line); border-bottom: 1px solid color-mix(in srgb, var(--c-accent) 45%, var(--cx-line)); background: color-mix(in srgb, var(--c-accent) 9%, var(--cx-head-bg)); padding-top: 8px; padding-bottom: 6px; }
.cx-div-teams th.cx-open-group small { display: block; margin-top: 2px; color: var(--c-ink-3); font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.cx-div-teams thead tr + tr th { padding-top: 6px; }
.cx-div-teams thead th.cx-open-col { background: color-mix(in srgb, var(--c-accent) 9%, var(--cx-head-bg)); color: var(--c-ink-2); font-size: 11.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.cx-div-teams td.cx-open-col { background: color-mix(in srgb, var(--c-accent) 4%, transparent); }
.cx-div-teams .cx-open-col.is-first { border-left: 1px solid var(--cx-line); }
.cx-div-teams .cx-open-col.is-last { border-right: 1px solid var(--cx-line); }
.cx-div-teams td.cx-open-col[title] { cursor: not-allowed; }
.cx-saved { display: inline-block; margin-right: 8px; color: var(--c-ok); font-size: 11.5px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.cx-saved.is-on { opacity: 1; }
.cx-saved.is-bad { color: var(--c-danger); }

/* ---- Activity log viewer ---- */
.cx-log { margin-top: 0; }
.cx-log-bar { margin-bottom: 12px; }
.cx-log-row { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.cx-log-row + .cx-log-row { margin-top: 8px; }
.cx-log-row .cx-label { margin-right: 6px; }
.cx-log-range { display: inline-flex; align-items: center; gap: 4px; color: var(--c-ink-3); }
.cx-log-range .cx-input { width: 132px; height: 30px; padding: 0 6px; font-size: 12.5px; color: var(--c-ink-3); color-scheme: light dark; }
.cx-log-range.is-on .cx-input { color: var(--c-ink); border-color: color-mix(in srgb, var(--c-accent) 55%, var(--cx-line-2)); }
.cx-log-row .cx-select { height: 30px; max-width: 220px; }
.cx-log-row .cx-log-people { max-width: 260px; }
.cx-log-row .cx-search { height: 30px; flex: 0 1 300px; }
.cx-log-dl { display: inline-flex; }
.cx-log-dl > .cx-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cx-log-dl .cx-menu > summary { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; padding: 0 9px; }

/* A small drop-down menu on a <details>. */
.cx-menu { position: relative; }
.cx-menu > summary { list-style: none; }
.cx-menu > summary::-webkit-details-marker { display: none; }
.cx-menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; padding: 6px; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); background: var(--c-surface); box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.cx-menu-pop small { display: block; padding: 4px 8px 6px; color: var(--c-ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.cx-menu-pop small:last-child { padding: 6px 8px 2px; font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 11.5px; border-top: 1px solid var(--cx-line); margin-top: 4px; }
.cx-menu-pop a { display: block; padding: 7px 8px; border-radius: 3px; color: var(--c-ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.cx-menu-pop a:hover, .cx-menu-pop a:focus-visible { background: var(--cx-row-hover); outline: none; }

.cx-log-table td { height: 38px; padding-top: 6px; padding-bottom: 6px; }
.cx-log-table tr.is-group td { height: 28px; padding-top: 0; padding-bottom: 0; color: var(--c-ink-2); }
.cx-log-table tbody tr.is-group:hover td { background: var(--cx-head-bg); }
.cx-log-tcol { width: 92px; }
.cx-log-time { width: 92px; white-space: nowrap; font: 500 12px var(--font-mono); color: var(--c-ink-3); }
.cx-log-table td.cx-log-time { color: var(--c-ink-3); }
.cx-log-what { min-width: 260px; }
.cx-log-what .cx-pri { margin-right: 6px; }
.cx-log-what .cx-tag { margin: 1px 4px 1px 0; }
.cx-log-what .cx-sub { margin-top: 1px; max-width: 72ch; overflow-wrap: anywhere; }
.cx-log-who { color: var(--c-ink-2); margin-right: 6px; }
.cx-log-person { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cx-log-where { white-space: nowrap; }
.cx-log-where small { display: inline-block; min-width: 0; margin-right: 4px; color: var(--c-ink-3); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cx-log-none { color: var(--c-ink-3); }
.cx-log-empty { padding: 40px 14px; }
.cx-log-empty b { display: block; color: var(--c-ink); font-size: 14px; margin-bottom: 4px; }
.cx-log-empty span { display: block; margin-bottom: 12px; }
.cx-log-empty .cx-btn { margin-top: 2px; }
.cx-log .cx-pager { margin-top: 10px; }

/* Compact card (Team settings): When / What happened / By, no filters. */
.cx-log.is-compact .cx-toolbar { margin-bottom: 10px; }
.cx-log.is-compact .cx-log-time { width: 84px; font-family: var(--font-body); font-size: 12.5px; }
.cx-log.is-compact .cx-log-what .cx-sub { display: none; }
.cx-log.is-compact .cx-log-what { min-width: 200px; }
.cx-log.is-compact .cx-log-what .cx-pri { margin-right: 0; }
.cx-log.is-compact .cx-log-who { margin: 0; }
.cx-log.is-compact .cx-log-what .cx-tag { margin: 1px 0 1px 6px; }
.cx-log.is-compact .cx-log-who::before { content: ' · '; color: var(--c-ink-3); }

@media (max-width: 900px) {
  .cx-addrow > .cx-input, .cx-org-person { width: 100%; flex: 1 1 100%; }
  .cx-addrow .cx-select { flex: 1 1 auto; }
  .cx-names-form .cx-names-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); flex-basis: 100%; }
  .cx-chip-add, .cx-chip-add .cx-input { flex: 1 1 auto; }
  .cx-org-why { flex-basis: 100%; }
  .cx-log-row .cx-search, .cx-log-row .cx-select, .cx-log-row .cx-log-people { flex: 1 1 100%; max-width: none; }
  .cx-log-range { flex: 1 1 100%; }
  .cx-log-range .cx-input { flex: 1 1 0; width: auto; }
  .cx-log-row .cx-seg { flex: 1 1 auto; }
  .cx-log-row .cx-seg > a { flex: 1 1 auto; justify-content: center; padding: 0 8px; }
  .cx-log-dl { margin-left: auto; }
  .cx-log-person { max-width: 160px; }
}

/* app.js turns each select into its own menu (c-goo, theme.css): square and compact here, like the cx inputs (override). */
.cx-org .c-goo.is-field, .cx-log .c-goo.is-field { display: inline-flex; width: auto; min-width: 150px; max-width: 260px; }
.cx-org .c-goo.is-field .c-goo-btn, .cx-log .c-goo.is-field .c-goo-btn { height: 30px; padding: 0 6px 0 10px; gap: 8px; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); background: var(--c-surface); font: 500 12.5px var(--font-body); }
.cx-org .c-goo.is-field .c-goo-btn:hover, .cx-log .c-goo.is-field .c-goo-btn:hover { border-color: color-mix(in srgb, var(--c-ink) 35%, var(--cx-line-2)); background: var(--c-surface); }
.cx-org .c-goo.is-field.is-open .c-goo-btn, .cx-log .c-goo.is-field.is-open .c-goo-btn { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.cx-org .c-goo.is-field .c-goo-chev, .cx-log .c-goo.is-field .c-goo-chev { width: 18px; height: 18px; }
.cx-org .c-goo.is-field .c-goo-menu, .cx-log .c-goo.is-field .c-goo-menu { border-radius: var(--cx-r); }
.cx-addrow .c-goo.is-field { min-width: 220px; }
@media (max-width: 900px) {
  .cx-log-row .c-goo.is-field, .cx-addrow .c-goo.is-field { flex: 1 1 100%; max-width: none; }
}

/* .c-main's top padding plus .cx-head's own 22px left too big a gap above the level bar (override, as Your profile does). */
.c-main:has(> .cx-org) { padding-top: 0; }
.c-main:has(> .cx-org) { padding-top: 0; }

/* Organization › Logs: the Terms of Service acceptances download (domains/legal). */
.cx-terms-export { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--cx-line, var(--c-line)); border-radius: 10px; }
.cx-terms-export div { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.cx-terms-export b { font-size: 14px; color: var(--c-ink); }
.cx-terms-export span { font-size: 13px; color: var(--c-ink-3); }
.cx-terms-export .c-btn { min-height: 40px; text-decoration: none; }

/* Organization logo (Settings → Organization; identity/org-logo.ts): the image, or its first letter until one is added. */
.cx-org-logo-img { flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--c-surface-2); }
.cx-org-logo-img.is-letter { display: grid; place-items: center; background: var(--c-accent); color: var(--c-accent-ink); font-weight: 800; font-size: 17px; }
.cx-org-logo { margin-bottom: 14px; }
.cx-org-logo .cx-help { min-width: 200px; }
.cx-org-logo label.cx-btn { cursor: pointer; }
.cx-org-logo label.cx-btn:focus-within { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ---- Settings → Organization: a box of short rows (logo, region, level names; email domains; requests waiting) ---- */
.cx-obox { margin-top: 14px; border: 1px solid var(--cx-line); border-radius: var(--cx-r); background: var(--c-surface); }
.cx-obox:first-child { margin-top: 0; }
.cx-orow { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-height: 56px; box-sizing: border-box; padding: 10px 16px; margin: 0; }
.cx-obox > * + .cx-orow, .cx-obox > * + .cx-orow-d, .cx-obox > .cx-orow-d + * { border-top: 1px solid var(--cx-line); }
.cx-orow-k { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; }
.cx-orow-k b { font-weight: 600; font-size: 13.5px; color: var(--c-ink); overflow-wrap: anywhere; }
.cx-orow-k small { font-size: 12.5px; color: var(--c-ink-3); overflow-wrap: anywhere; }
.cx-orow-t { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cx-orow-t .cx-select { min-width: 220px; }
.cx-mono { font-family: var(--font-mono); }
.cx-orow-d > summary { list-style: none; cursor: pointer; }
.cx-orow-d > summary::-webkit-details-marker { display: none; }
.cx-orow-d > summary:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
.cx-orow-d[open] > summary .cx-btn { background: color-mix(in srgb, var(--c-ink) 8%, transparent); }
.cx-org-box .cx-org-logo-img { width: 36px; height: 36px; }
/* Requests waiting: a warm box, first in Who can join. */
.cx-wait { border-color: color-mix(in srgb, var(--c-warn) 45%, var(--cx-line)); background: color-mix(in srgb, var(--c-warn) 7%, var(--c-surface)); }
.cx-wait-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--c-warn); flex: none; }
.cx-org-join { margin-top: 22px; }
/* The Divisions heading under the organization box gets the same air as Who can join. */
.cx-org-box + .cx-toolbar { margin-top: 22px; }
.cx-org-join > .cx-toolbar + .cx-obox { margin-top: 0; }

/* Divisions table: the name with its rename pencil; + Team among the team tags. */
.cx-div-name { display: inline-flex; align-items: center; gap: 6px; }
.cx-icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--c-ink-3); cursor: pointer; }
.cx-icon-btn:hover { color: var(--c-ink); background: color-mix(in srgb, var(--c-ink) 8%, transparent); }
.cx-icon-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.cx-tag.is-add { border-style: dashed; background: none; color: var(--c-ink-3); cursor: pointer; font: inherit; }
.cx-tag.is-add:hover { color: var(--c-ink); border-color: var(--c-ink-3); }

/* Invite links: the four set-up fields and Create link on one line, the links made below. */
.cx-invite-form { display: flex; align-items: flex-end; gap: 8px 10px; flex-wrap: wrap; padding: 12px 16px; margin: 0; }
.cx-invite-h { flex: 1 1 100%; font-weight: 600; font-size: 13.5px; color: var(--c-ink); }
.cx-invite-form label { display: grid; gap: 3px; flex: 1 1 140px; font-size: 11.5px; font-weight: 600; color: var(--c-ink-3); }
.cx-invite-form .cx-select { width: 100%; }
.cx-invite-form .cx-btn { flex: 0 0 auto; }
.cx-invite-list { border-top: 1px solid var(--cx-line); overflow-x: auto; }
.cx-invite-list .cx-table { min-width: 600px; }
.cx-invite-list tr.is-off td { color: var(--c-ink-3); }
/* An invite link's on/off switch: a button (role="switch", aria-checked), not console.css's checkbox .cx-switch. */
.cx-link-switch { display: inline-flex; align-items: center; width: 40px; height: 24px; padding: 3px; box-sizing: border-box; border: 1px solid var(--cx-line-2); border-radius: 12px; background: var(--c-bg); cursor: pointer; vertical-align: middle; }
.cx-link-switch > span { width: 16px; height: 16px; border-radius: 8px; background: var(--c-ink-3); transition: transform .15s ease; }
.cx-link-switch[aria-checked='true'] { border-color: var(--c-accent); background: var(--c-accent); }
.cx-link-switch[aria-checked='true'] > span { background: var(--c-accent-ink, #fff); transform: translateX(16px); }
.cx-link-switch:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .cx-orow-t { margin-left: 0; flex: 1 1 100%; }
  .cx-orow-t .cx-select { flex: 1 1 auto; min-width: 0; height: 40px; font-size: 16px; }
  .cx-orow-t .cx-btn { height: 40px; }
  .cx-org-box .cx-orow > .cx-orow-t, .cx-org-box .cx-orow-d .cx-orow-t { flex: 0 0 auto; margin-left: auto; }
  .cx-org-box .cx-orow-k { flex-basis: 120px; }
  .cx-org-box .cx-region-row .cx-orow-t { flex: 1 1 100%; }
  .cx-invite-form label { flex: 1 1 calc(50% - 10px); }
  .cx-invite-form .cx-select { height: 40px; font-size: 16px; }
  .cx-invite-form .cx-btn { flex: 1 1 100%; height: 44px; }
  .cx-icon-btn { width: 40px; height: 40px; }
  .cx-tag.is-add { min-height: 32px; }
  .cx-link-switch { width: 48px; height: 28px; }
  .cx-link-switch > span { width: 20px; height: 20px; border-radius: 10px; }
  .cx-link-switch[aria-checked='true'] > span { transform: translateX(20px); }
}
