/* ==========================================================================================================
   Console: the shared look of Settings (Organization, Division, Team) and Your profile.
   Square corners (4px), hairline tables, bold headings, one header + tab pattern everywhere. Colors come only
   from the theme tokens in theme.css (--c-*), so every theme recolors it. Page-specific rules live in
   console-org.css, console-team.css and console-profile.css; keep this file to shared building blocks.
   Components: src/ui/console.tsx.
   ========================================================================================================== */
.cx { --cx-r: 4px; --cx-line: var(--c-line); --cx-line-2: color-mix(in srgb, var(--c-ink) 14%, var(--c-line)); --cx-head-bg: color-mix(in srgb, var(--c-ink) 3%, var(--c-bg)); --cx-row-hover: color-mix(in srgb, var(--c-ink) 4%, transparent); color: var(--c-ink); }
.cx *, .cx *::before, .cx *::after { box-sizing: border-box; }

/* ---- Page head: level bar, kicker, title, facts, actions, tabs ---- */
.cx-head { padding: 22px 0 0; border-bottom: 1px solid var(--cx-line); margin-bottom: 20px; }
.cx-levels { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; }
.cx-levels a { display: block; min-width: 72px; padding: 3px 10px 4px 8px; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); color: var(--c-ink-2); text-decoration: none; line-height: 1.2; }
.cx-levels a:hover { border-color: color-mix(in srgb, var(--c-accent) 55%, var(--cx-line-2)); color: var(--c-ink); }
.cx-levels a small { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink-3); }
.cx-levels a span { font-weight: 600; font-size: 12px; }
.cx-levels a[aria-current='page'] { color: var(--c-ink); background: color-mix(in srgb, var(--c-accent) 12%, transparent); border-color: color-mix(in srgb, var(--c-accent) 55%, var(--cx-line-2)); box-shadow: inset 0 -2px 0 var(--c-accent); }
.cx-levels-sep { color: var(--c-ink-3); font-size: 13px; }
.cx-titlerow { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cx-kicker { font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--c-accent); }
.cx-title { margin: 2px 0 0; font: 800 30px/1.12 var(--font-display); letter-spacing: -.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cx-code { font: 500 11.5px var(--font-mono); color: var(--c-ink-3); letter-spacing: 0; }
.cx-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cx-facts { display: flex; gap: 6px 26px; flex-wrap: wrap; margin-top: 10px; color: var(--c-ink-3); font-size: 12px; }
.cx-facts b { color: var(--c-ink); font-weight: 700; font-size: 13px; margin-right: 4px; }
.cx-tabs { display: flex; gap: 26px; margin-top: 18px; overflow-x: auto; scrollbar-width: none; }
.cx-tabs::-webkit-scrollbar { display: none; }
.cx-tabs a { display: flex; align-items: center; gap: 7px; padding: 0 0 11px; border-bottom: 2px solid transparent; color: var(--c-ink-3); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.cx-tabs a:hover { color: var(--c-ink); }
.cx-tabs a[aria-current='page'] { color: var(--c-ink); border-bottom-color: var(--c-accent); }
.cx-n { font: 600 11px var(--font-mono); color: var(--c-ink-3); }
.cx-n.is-warn { color: #0b0e17; background: var(--c-warn); padding: 0 5px; border-radius: 3px; font-weight: 800; }

/* ---- Content card: each Settings tab's content, with a colored top edge and a title naming the level (ConsoleCard) ---- */
.cx-card { border: 1px solid var(--cx-line); border-top: 2px solid var(--c-accent); border-radius: 10px; background: color-mix(in srgb, var(--c-surface) 55%, var(--c-bg)); }
.cx-card-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--cx-line); }
.cx-card-title { margin: 0; font: 800 19px/1.25 var(--font-display); letter-spacing: -.01em; }
.cx-card-title em { font-style: normal; color: var(--c-accent); }
.cx-card-desc { margin: 4px 0 0; max-width: 90ch; color: var(--c-ink-2); font-size: 13px; line-height: 1.5; }
.cx-card-note { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; color: var(--c-warn); font-size: 12.5px; line-height: 1.45; }
.cx-card-note svg { flex: none; margin-top: 2px; }
.cx-card-body { padding: 18px 22px 22px; min-width: 0; }

/* ---- Buttons ---- */
.cx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); background: transparent; color: var(--c-ink); font: 600 12.5px/1 var(--font-body); white-space: nowrap; text-decoration: none; cursor: pointer; }
.cx-btn:hover { border-color: color-mix(in srgb, var(--c-ink) 35%, var(--cx-line-2)); background: var(--cx-row-hover); }
.cx-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.cx-btn:disabled, .cx-btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; }
.cx-btn.is-primary { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-bg); }
.cx-btn.is-primary:hover { background: color-mix(in srgb, var(--c-ink) 88%, var(--c-bg)); }
.cx-btn.is-accent { background: var(--c-btn, var(--c-accent)); border-color: var(--c-btn, var(--c-accent)); color: var(--c-accent-ink); }
.cx-btn.is-danger { color: var(--c-danger); border-color: color-mix(in srgb, var(--c-danger) 45%, var(--cx-line-2)); }
.cx-btn.is-quiet { border-color: transparent; color: var(--c-ink-2); }
.cx-btn.is-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.cx-link { color: var(--c-accent); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.cx-link:hover { text-decoration: underline; }

/* ---- Toolbar above a table ---- */
.cx-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cx-label { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--c-ink-2); }
.cx-grow { flex: 1; }
.cx-help { color: var(--c-ink-3); font-size: 12px; }
.cx-seg { display: inline-flex; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); overflow: hidden; }
.cx-seg > a, .cx-seg > button, .cx-seg > label { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-right: 1px solid var(--cx-line-2); background: transparent; color: var(--c-ink-3); font: 600 12.5px var(--font-body); text-decoration: none; cursor: pointer; }
.cx-seg > :last-child { border-right: 0; }
.cx-seg > [aria-current='page'], .cx-seg > [aria-pressed='true'], .cx-seg > .is-on, .cx-seg > label:has(input:checked) { background: color-mix(in srgb, var(--c-ink) 8%, transparent); color: var(--c-ink); }
.cx-seg input { position: absolute; opacity: 0; pointer-events: none; }

/* ---- Inputs ---- */
.cx-input, .cx-select, .cx-textarea { height: 32px; padding: 0 10px; border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); background: var(--c-surface); color: var(--c-ink); font: 13px var(--font-body); }
.cx-input:focus, .cx-select:focus, .cx-textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.cx-input::placeholder, .cx-textarea::placeholder { color: var(--c-ink-3); }
.cx-textarea { height: auto; min-height: 150px; padding: 10px 11px; line-height: 1.55; resize: vertical; width: 100%; }
.cx-search { width: 260px; max-width: 100%; }
.cx-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cx-field > label, .cx-field > .cx-field-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink-3); }
.cx-field .cx-input, .cx-field .cx-select { width: 100%; height: 34px; }
.cx-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cx-fields.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---- Tables ---- */
.cx-table-wrap { border: 1px solid var(--cx-line); border-radius: var(--cx-r); background: var(--c-surface); overflow-x: auto; }
.cx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cx-table th { text-align: left; padding: 9px 14px; background: var(--cx-head-bg); border-bottom: 1px solid var(--cx-line); color: var(--c-ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.cx-table td { padding: 0 14px; height: 46px; border-bottom: 1px solid var(--cx-line); color: var(--c-ink-2); vertical-align: middle; }
.cx-table tr:last-child td { border-bottom: 0; }
.cx-table tbody tr:hover td { background: var(--cx-row-hover); }
.cx-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.cx-table .is-end { text-align: right; white-space: nowrap; }
.cx-table .is-center { text-align: center; }
.cx-pri { color: var(--c-ink); font-weight: 600; }
.cx-sub { display: block; color: var(--c-ink-3); font-size: 11.5px; font-weight: 400; }
.cx-table tr.is-pending td { background: color-mix(in srgb, var(--c-warn) 7%, transparent); }
.cx-table tr.is-pending td:first-child { box-shadow: inset 3px 0 0 var(--c-warn); }
.cx-table tr.is-add td { background: var(--cx-head-bg); }
.cx-table tr.is-group td { height: 30px; background: var(--cx-head-bg); color: var(--c-ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.cx-row-link { color: inherit; text-decoration: none; }
.cx-row-link:hover { color: var(--c-accent); }
.cx-empty { padding: 28px 14px; text-align: center; color: var(--c-ink-3); }
.cx-pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--c-ink-3); font-size: 12px; }

/* ---- Small parts ---- */
.cx-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; margin: 1px 4px 1px 0; border: 1px solid var(--cx-line-2); border-radius: 3px; color: var(--c-ink-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.cx-tag.is-accent { border-color: color-mix(in srgb, var(--c-accent) 50%, transparent); color: var(--c-accent); }
.cx-tag.is-warn { border-color: color-mix(in srgb, var(--c-warn) 50%, transparent); color: var(--c-warn); }
.cx-tag.is-ok { border-color: color-mix(in srgb, var(--c-ok) 50%, transparent); color: var(--c-ok); }
.cx-tag.is-mono { font: 500 11.5px var(--font-mono); color: var(--c-ink); }
.cx-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cx-av { width: 28px; height: 28px; border-radius: var(--cx-r); display: grid; place-items: center; flex: none; overflow: hidden; background: var(--c-accent-soft); color: var(--c-accent); font-size: 10.5px; font-weight: 800; }
.cx-av img { width: 100%; height: 100%; object-fit: cover; }
.cx-check { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--cx-line-2); border-radius: 3px; background: transparent; display: inline-grid; place-items: center; cursor: pointer; vertical-align: middle; }
.cx-check:checked { background: var(--c-accent); border-color: var(--c-accent); }
.cx-check:checked::after { content: ''; width: 9px; height: 5px; border: 2px solid var(--c-accent-ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.cx-check:disabled { opacity: .45; cursor: not-allowed; }
.cx-check:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.cx-switch { appearance: none; -webkit-appearance: none; position: relative; width: 32px; height: 18px; margin: 0; border-radius: 9px; background: var(--cx-line-2); cursor: pointer; flex: none; transition: background .15s; }
.cx-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--c-ink-3); transition: transform .15s, background .15s; }
.cx-switch:checked { background: var(--c-accent); }
.cx-switch:checked::after { transform: translateX(14px); background: #fff; }
.cx-switch:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* One-line strip: a label, then chips/inputs in a row (email domains, level names). */
.cx-strip { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 14px; padding: 11px 14px; border: 1px solid var(--cx-line); border-radius: var(--cx-r); background: var(--c-surface); }
.cx-strip > .cx-label { min-width: 120px; }

/* Skills on Organization, Division and Team settings, Your profile and Admin (skills-page.tsx): a row per skill, the
   buttons wrapping under it when narrow, and the upload form folded under its button. */
.cx-skill-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--cx-line); border-radius: var(--cx-r); background: var(--c-surface); }
.cx-skill { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-bottom: 1px solid var(--cx-line); }
.cx-skill:last-child { border-bottom: 0; }
.cx-skill-main { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.cx-skill-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 4px; }
.cx-skill-meta .cx-tag.is-mono { white-space: normal; height: auto; min-height: 20px; overflow-wrap: anywhere; }
.cx-skill-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-skill-upload { margin-top: 12px; }
.cx-skill-upload > summary { list-style: none; }
.cx-skill-upload > summary::-webkit-details-marker { display: none; }
.cx-skill-upload[open] > summary { margin-bottom: 12px; }
.cx-skill-upload form { display: grid; gap: 12px; justify-items: start; }
.cx-skill-upload form > .cx-fields, .cx-skill-upload form > .cx-field { width: 100%; }
.cx-skill-upload .cx-textarea { height: auto; padding: 8px 10px; width: 100%; }
.cx-skill-upload .cx-file { max-width: 100%; font-size: 12.5px; }
/* The team's media library (Settings → Skills & media): image cards with their link, wrapping to fit. */
.cx-media-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cx-media { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 8px; border: 1px solid var(--cx-line); border-radius: var(--cx-r); background: var(--c-surface); }
.cx-media > a { display: block; width: 100%; }
.cx-media img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; background: var(--cx-head-bg); }
.cx-media .cx-pri { font-size: 12.5px; overflow-wrap: anywhere; }
.cx-media-url { color: var(--c-ink-3); font: 500 10.5px var(--font-mono); overflow-wrap: anywhere; }

/* ---- Form sections: label column + controls ---- */
.cx-sections { max-width: 1100px; }
.cx-section { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; padding: 16px 0; border-top: 1px solid var(--cx-line); }
.cx-section:first-child { border-top: 0; padding-top: 0; }
.cx-section-l b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.cx-section-l span { color: var(--c-ink-3); font-size: 12px; }
.cx-lrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; border-bottom: 1px solid var(--cx-line); }
.cx-lrow:last-child { border-bottom: 0; }
.cx-lrow-t { font-weight: 600; }
.cx-lrow-t small { display: block; font-weight: 400; color: var(--c-ink-3); font-size: 11.5px; }

/* A row of options, one picked (radio inputs inside labels). */
.cx-choice { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--cx-line-2); border-radius: var(--cx-r); overflow: hidden; }
.cx-choice.is-inline { display: inline-grid; grid-auto-columns: auto; }
.cx-choice > label { position: relative; display: block; padding: 10px 12px; border-right: 1px solid var(--cx-line-2); cursor: pointer; }
.cx-choice > label:last-child { border-right: 0; }
.cx-choice.is-inline > label { padding: 0 14px; height: 32px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--c-ink-3); }
.cx-choice input { position: absolute; opacity: 0; pointer-events: none; }
.cx-choice b { display: block; font-size: 13px; }
.cx-choice small { color: var(--c-ink-3); font-size: 11.5px; }
.cx-choice > label:hover { background: var(--cx-row-hover); }
.cx-choice > label:has(input:checked) { background: color-mix(in srgb, var(--c-accent) 12%, transparent); color: var(--c-ink); box-shadow: inset 0 -2px 0 var(--c-accent); }
.cx-choice > label:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: -2px; }

/* Sticky bar that appears when a form has unsaved changes. */
.cx-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 20px; padding: 10px 0; border-top: 1px solid var(--cx-line); background: var(--c-bg); color: var(--c-ink-3); font-size: 12px; }
.cx-savebar[hidden] { display: none; }

.cx-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.cx-region { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; max-width: 360px; margin: 0 0 16px; }
.cx-region .cx-field { width: 100%; }

@media (max-width: 900px) {
  .cx-title { font-size: 24px; }
  .cx-card-head { padding: 14px 14px 12px; }
  .cx-card-body { padding: 14px; }
  .cx-skill-actions .cx-btn, .cx-skill-upload > summary.cx-btn, .cx-media .cx-btn { height: 40px; }
  .cx-skill-upload .cx-input, .cx-skill-upload .cx-textarea { font-size: 16px; }
  .cx-section { grid-template-columns: 1fr; gap: 10px; }
  .cx-fields, .cx-fields.is-3, .cx-two { grid-template-columns: 1fr; }
  .cx-choice { grid-auto-flow: row; }
  .cx-choice > label { border-right: 0; border-bottom: 1px solid var(--cx-line-2); }
  .cx-choice > label:last-child { border-bottom: 0; }
  .cx-search { width: 100%; }
  .cx-levels a { min-width: 0; }
  .cx-region { max-width: none; }
  .cx-region .cx-select, .cx-region .cx-btn { height: 40px; font-size: 16px; }
}
