/* 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; }
.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; }
