/* Carrier Exchange: page chrome on top of the Module UI Standard (ds/module-ds.css).
   Everything colours through DS tokens, so the dark register needs no rules here.

   Register: the Clients module (liberty-os modules/clients). White canvas, hairlines
   and cards; no dark panels. Carrier Exchange is standalone rather than hosted in the
   OS shell, so unlike a module it draws its own topbar and nav, built from the same
   tokens and .lds-tabs so it reads as the same system.

   Layout rules (2026-09-22). Every page is built from the same few parts, so pages
   share edges and rhythm:
     1. One gutter. --lds-gap separates everything, horizontally AND vertically.
     2. One grid. KPI rows are 4 or 3 fixed columns; card rows are 2 equal columns
        whose edges fall exactly on the KPI boundaries (the maths is the same gap).
        Cards in one row stretch to one height, so a row is a clean band.
     3. Tables always run edge to edge in their card (.cx-flush), fixed layout,
        single-line cells, so a table fits its card and every row is one height.
     4. One page width: .lds-measure. Views never add their own padding. */

/* The scrollbar appearing on long pages and vanishing on short ones slid the whole
   layout 7px sideways between tabs. Reserve the gutter so every page shares edges. */
html { scrollbar-gutter: stable; }

/* ---- topbar ------------------------------------------------------------- */
.cx-topbar {
  background: var(--lds-canvas);
  border-bottom: 1px solid var(--lds-line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.cx-topbar-in {
  max-width: var(--lds-canvas-max);
  margin: 0 auto;
  padding: 0 28px;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cx-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; text-decoration: none; }
.cx-brand img { height: 20px; display: block; }
.cx-brand-sep { width: 1px; height: 18px; background: var(--lds-line); }

.cx-search {
  flex: 1;
  min-width: 180px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--lds-canvas-2);
  border: 1px solid var(--lds-line);
  border-radius: var(--lds-r2);
  padding: 0 12px;
  min-height: 44px;
}
.cx-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font: inherit;
  font-size: 13px;
  color: var(--lds-ink);
}
.cx-kbd {
  font-size: 10px;
  font-weight: 600;
  color: var(--lds-ink-4);
  border: 1px solid var(--lds-line);
  border-radius: var(--lds-r1);
  padding: 2px 6px;
}

/* 44px floor (rule 08): the icon button is a control. */
.cx-iconbtn {
  width: 44px;
  height: 44px;
  border-radius: var(--lds-r2);
  border: 1px solid var(--lds-line);
  background: var(--lds-canvas);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cx-iconbtn:hover { background: var(--lds-brand-soft); border-color: var(--lds-brand-2); }
.cx-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lds-gold);        /* a status mark (unread), not decoration */
  border: 1.5px solid var(--lds-canvas);
}

.cx-user { display: flex; align-items: center; gap: 9px; padding-left: 13px; border-left: 1px solid var(--lds-line); }
.cx-user-name { font-size: 13px; font-weight: 600; color: var(--lds-ink); line-height: 1.25; }
.cx-user-role { font-size: 11px; color: var(--lds-ink-3); line-height: 1.25; }

/* One avatar everywhere: people are brand, organisations are the brand wash. */
.cx-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lds-brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.cx-avatar--soft { background: var(--lds-brand-soft); color: var(--lds-brand); }

/* ---- nav ----------------------------------------------------------------- */
.cx-nav { margin: 0 0 22px; flex-wrap: wrap; }
.cx-tabcount {
  font-family: var(--lds-data);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--lds-ink-3);
}
.lds-tab.on .cx-tabcount { color: var(--lds-brand); }

.cx-org { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
.cx-org-name { font-size: 13px; font-weight: 600; color: var(--lds-ink); }
.cx-org-sub { font-size: 12px; color: var(--lds-ink-3); }
.cx-org .cx-select-wrap { margin-left: auto; min-width: 220px; }

/* ---- page rhythm (rule 1) ---------------------------------------------- */
.cx-page { display: flex; flex-direction: column; gap: var(--lds-gap); }
.cx-page > * { margin: 0; }          /* the sheet's own margins would double the gutter */
.cx-page > .lds-header { margin-bottom: 4px; }
.cx-stack { display: flex; flex-direction: column; gap: var(--lds-gap); }

.cx-crumb { font-size: 12px; font-weight: 600; margin-bottom: -6px; }
.cx-crumb a { color: var(--lds-ink-3); cursor: pointer; text-decoration: none; }
.cx-crumb a:hover { color: var(--lds-brand); }

/* ---- the grid (rule 2) --------------------------------------------------- */
.lds-kpi-grid.cx-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lds-kpi-grid.cx-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lds-kpi-grid .lds-kpi { min-width: 0; }
.lds-kpi-grid .lds-kpi-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cx-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lds-gap); align-items: stretch; }
.cx-grid-2 > * { min-width: 0; }
.cx-span-2 { grid-column: 1 / -1; }
/* The account page: four columns on the KPI columns, so wide content (span 3) and the
   people-and-markets rail (span 1) share edges with the KPIs above them. */
.cx-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--lds-gap); align-items: stretch; }
.cx-grid-4 > * { min-width: 0; }
.cx-span-3 { grid-column: span 3; }
.cx-span-4 { grid-column: 1 / -1; }
.cx-rows-2 { grid-row: span 2; }     /* the team rail beside overview + facts */

/* A card is a column, so a footnote can sit on the card's floor in a stretched row. */
.lds-card { display: flex; flex-direction: column; min-width: 0; }
.lds-card > .lds-card-h { flex-wrap: wrap; }
.cx-card-foot {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--lds-line-soft);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--lds-ink-3);
}
/* In a stretched row the block above the footnote takes the slack, so every footnote
   in a row sits on the same floor. */
.lds-card > .cx-grow { flex-grow: 1; }

@media (max-width: 900px) {
  .lds-kpi-grid.cx-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-grid-2, .cx-grid-4 { grid-template-columns: 1fr; }
  .cx-span-3 { grid-column: auto; }
  .cx-rows-2 { grid-row: auto; }
}
@media (max-width: 640px) {
  .lds-kpi-grid.cx-kpis-4, .lds-kpi-grid.cx-kpis-3 { grid-template-columns: 1fr; }
}

/* ---- flush cards and tables (rule 3) ----------------------------------- */
.lds-card.cx-flush { padding: 0; overflow: hidden; }
.cx-flush > .lds-card-h { padding: 14px 18px; margin: 0; }
.cx-sec { padding: 14px 18px; }
.cx-flush > * + * { border-top: 1px solid var(--lds-line); }
.cx-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 44px; box-sizing: content-box; }
.cx-bar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }

.cx-tablewrap { overflow-x: auto; }
.cx-table { table-layout: fixed; width: 100%; }
.cx-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom-width: 1px; }
.cx-table td { vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-table th:first-child, .cx-table td:first-child { padding-left: 18px; }
.cx-table th:last-child, .cx-table td:last-child { padding-right: 18px; }
.cx-table tbody tr:last-child td { border-bottom: 0; }
.cx-table td.cx-wrap { white-space: normal; }
.cx-table tr.is-off td { opacity: .6; }
.cx-row { cursor: pointer; }
.cx-row.is-sel { background: var(--lds-brand-soft); }
.cx-sortable { cursor: pointer; user-select: none; }
.cx-sortable:hover { color: var(--lds-brand); }
.cx-check { width: 16px; height: 16px; accent-color: var(--lds-brand); cursor: pointer; vertical-align: middle; margin: 0; }
.cx-cell-2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cx-cell-main { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; color: var(--lds-ink); }
.cx-cell-meta { font-size: 11.5px; color: var(--lds-ink-3); }
.cx-cell-main .lds-badge { flex-shrink: 0; }
.cx-cell-go { text-align: right; color: var(--lds-ink-4); }
.cx-cell-go svg { vertical-align: middle; }
.cx-trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cx-strong { font-weight: 700; color: var(--lds-ink); }
.cx-more { font-size: 11px; font-weight: 600; color: var(--lds-ink-3); }
.cx-muted { color: var(--lds-ink-4); }
.cx-muted-ink { color: var(--lds-ink-3); }
.cx-mono { font-family: var(--lds-mono); font-size: 12px; }

/* ---- controls ------------------------------------------------------------ */
/* The filter grid is 4 x 2: seven filters and the actions in the eighth cell, so the
   actions sit on the filters' baseline instead of on a row of their own. */
.cx-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--lds-gap); align-items: end; }
.cx-filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 900px) { .cx-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cx-select-wrap { min-width: 0; }
.cx-select-box { position: relative; display: block; }
select.cx-select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding-right: 34px;
  font-weight: 600;
  cursor: pointer;
}
.cx-select-caret {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--lds-ink-3);
  display: inline-flex;
}
.lds-input.cx-field { width: 100%; min-height: 44px; box-sizing: border-box; }
textarea.lds-input.cx-field { min-height: 92px; resize: vertical; }
.lds-btn { min-height: 44px; box-sizing: border-box; }
.lds-btn.cx-icon-only { width: 44px; padding: 0; }
.lds-btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }

.cx-search-field { position: relative; flex: 1; min-width: 220px; max-width: 360px; display: block; }
.cx-search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.cx-search-field .lds-input { padding-left: 36px; }

.cx-count { font-size: 13px; color: var(--lds-ink-3); }
.cx-count b { color: var(--lds-ink); font-family: var(--lds-data); font-variant-numeric: tabular-nums; font-weight: 700; }
.cx-chip { cursor: pointer; }
.cx-chip span { color: var(--lds-ink-3); font-size: 14px; line-height: 1; }
.cx-chip:hover span { color: var(--lds-crit); }

.cx-pager { display: flex; align-items: center; gap: 8px; }
.cx-pager .lds-seg button { min-width: 36px; font-family: var(--lds-data); font-variant-numeric: tabular-nums; }

/* ---- account ------------------------------------------------------------- */
.cx-prose { font-size: 14px; line-height: 1.65; color: var(--lds-ink-2); margin: 0; text-wrap: pretty; }
.cx-facts { display: grid; grid-template-columns: 128px minmax(0, 1fr); row-gap: 11px; column-gap: 14px; align-content: start; margin: 0; font-size: 13px; }
.cx-facts dt { color: var(--lds-ink-3); font-weight: 600; }
.cx-facts dd { margin: 0; color: var(--lds-ink); overflow-wrap: anywhere; }
.cx-src { display: block; font-size: 11px; color: var(--lds-ink-3); margin-top: 1px; }
/* In a wide card the facts pair up (Customer ID | Industry, Headquarters | Address, ...). */
.cx-facts--2 { grid-template-columns: 118px minmax(0, 1fr) 118px minmax(0, 1fr); column-gap: 18px; }
@media (max-width: 1100px) { .cx-facts--2 { grid-template-columns: 118px minmax(0, 1fr); } }

/* Servicing team: one block per role, the lead first, others with the lines they handle. */
.cx-roles { display: flex; flex-direction: column; gap: 14px; }
.cx-role { display: flex; flex-direction: column; gap: 10px; }
.cx-role + .cx-role { padding-top: 14px; border-top: 1px solid var(--lds-line-soft); }

.cx-people { display: flex; flex-direction: column; gap: 14px; }
.cx-person { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; align-items: center; }
.cx-person-body { min-width: 0; }
.cx-person-name { font-size: 13.5px; font-weight: 600; color: var(--lds-ink); }
.cx-person-role, .cx-person-mail { font-size: 11.5px; color: var(--lds-ink-3); }
.cx-person-mail { color: var(--lds-brand-text); }

.cx-prows { display: flex; flex-direction: column; }
.cx-prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 10px 0; border-top: 1px solid var(--lds-line-soft); }
.cx-prow:first-child { border-top: 0; padding-top: 0; }
.cx-prow-label { font-size: 13px; font-weight: 600; color: var(--lds-ink); }
.cx-prow-val { font-size: 15px; font-weight: 700; color: var(--lds-brand); white-space: nowrap; }
.cx-quote { font-size: 11.5px; font-style: italic; color: var(--lds-ink-3); margin-top: 4px; }
.cx-listblock { margin-top: 14px; }
.cx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-listblock .cx-tags { margin-top: 6px; }
.cx-note-caut { background: var(--lds-caut-soft); border-color: var(--lds-caut); color: var(--lds-caut); margin: 0 0 12px; }

/* ---- requests ------------------------------------------------------------ */
.cx-req { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.cx-req-body { min-width: 0; }
.cx-req-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14.5px; font-weight: 600; color: var(--lds-ink); }
.cx-req-body > .cx-tags { margin-top: 8px; }
.cx-req-note { font-size: 12.5px; line-height: 1.5; color: var(--lds-ink-2); margin-top: 8px; max-width: 70ch; }
.cx-req-meta { font-size: 11.5px; color: var(--lds-ink-3); margin-top: 8px; }
.cx-req-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.cx-req-side small { font-size: 11px; font-weight: 600; color: var(--lds-ink-3); }
.lds-card.is-hl { box-shadow: 0 0 0 3px var(--lds-brand-3), var(--lds-sh1); }
.cx-sub-sec { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--lds-line-soft); }
.cx-sub-sec > .lds-filter-label { display: block; margin-bottom: 10px; }
.cx-confirm-list { display: flex; flex-direction: column; gap: 8px; }
.cx-confirm-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 180px auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--lds-line);
  border-radius: var(--lds-r2);
  cursor: pointer;
}
.cx-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cx-actions .cx-spacer { margin-right: auto; font-size: 12px; color: var(--lds-ink-3); }
.cx-sent-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cx-sent-line .cx-src { display: inline; margin: 0 4px 0 0; font-weight: 600; color: var(--lds-pos); }

/* ---- saved views --------------------------------------------------------- */
.cx-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lds-gap); }
.cx-view { cursor: pointer; gap: 10px; transition: border-color .12s var(--lds-ease); }
.cx-view:hover { border-color: var(--lds-brand-2); }
.cx-view-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cx-view-name { font-size: 15px; font-weight: 700; color: var(--lds-ink); }
.cx-view-desc { font-size: 12.5px; color: var(--lds-ink-3); }
.cx-view-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--lds-line-soft); font-size: 11.5px; color: var(--lds-ink-3); }
.cx-linkbtn { border: 0; background: none; font: inherit; font-weight: 600; color: var(--lds-ink-3); cursor: pointer; padding: 0; min-height: 0; }
.cx-linkbtn:hover { color: var(--lds-crit); }
@media (max-width: 900px) { .cx-gallery { grid-template-columns: 1fr; } }

/* ---- tracking ------------------------------------------------------------ */
.cx-bars { display: flex; flex-direction: column; margin: 0 -12px; }
.cx-bars .lds-bar-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 132px; }
.cx-list { display: flex; flex-direction: column; }
.cx-list-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 10px 0; border-top: 1px solid var(--lds-line-soft); }
.cx-list-row:first-child { border-top: 0; padding-top: 0; }
.cx-state {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  justify-self: center;
  background: var(--lds-ink-4);
}
.cx-state--pos { background: var(--lds-pos); }
.cx-state--crit { background: var(--lds-crit); }
.cx-list-val { font-family: var(--lds-data); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--lds-brand); font-size: 13px; white-space: nowrap; }

/* ---- modals, drawer, toast ---------------------------------------------- */
.cx-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);       /* a Black tint (rule 01); the cool scrim is retired */
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lpFade .2s var(--lds-ease);
}
.cx-scrim--side { justify-content: flex-end; align-items: stretch; padding: 0; z-index: 40; }
.cx-modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  background: var(--lds-surface);
  border: 1px solid var(--lds-line);
  border-radius: var(--lds-r4);
  box-shadow: var(--lds-sh3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: lpPop .26s var(--lds-ease);
}
.cx-modal--wide { max-width: 560px; }
.cx-drawer { max-width: 540px; max-height: none; height: 100vh; border-radius: 0; border-width: 0 0 0 1px; }
.cx-modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--lds-line); }
.cx-modal-h .lds-card-title { font-size: 18px; margin-top: 4px; }
.cx-modal-h .lds-sub { margin-top: 4px; }
.cx-modal-b { padding: 18px 22px; overflow: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; }
/* Two actions share the footer equally: the old 1 : 1.4 split read as a mistake. */
.cx-modal-f { padding: 14px 22px; border-top: 1px solid var(--lds-line); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cx-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--lds-gap); }
.cx-field-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cx-label { display: block; font-size: 12px; font-weight: 600; color: var(--lds-ink-2); margin: 0 0 6px; }
.cx-static { min-height: 44px; display: flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--lds-ink-4); }
.cx-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }
.cx-mini-list { display: flex; flex-direction: column; gap: 8px; max-height: 190px; overflow: auto; }
.cx-mini-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 12px; border: 1px solid var(--lds-line); border-radius: var(--lds-r2); }

.cx-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--lds-ink);
  color: #fff;
  border-radius: var(--lds-r2);
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--lds-sh2);
}

/* ---- footer -------------------------------------------------------------- */
.cx-foot {
  border-top: 1px solid var(--lds-line);
  margin-top: 16px;
  padding: 16px 28px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--lds-ink-4);
  text-align: center;
}

/* ---- sign in ------------------------------------------------------------- */
.cx-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.cx-login-in { width: 100%; max-width: 420px; }
.cx-login .lds-input, .cx-login .lds-btn { width: 100%; }
/* Named apart from .cx-row (a table row): sharing the name made every <tr> a flex box. */
.cx-login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; margin: 14px 0 18px; }
.cx-check-label { display: flex; align-items: center; gap: 8px; color: var(--lds-ink-2); cursor: pointer; }
.cx-linklike { color: var(--lds-brand); font-weight: 600; cursor: pointer; }
.cx-linklike:hover { text-decoration: underline; }
