/*
 * CareHub web — shell + shared component styles.
 *
 * PROVENANCE: hand-written CSS reproducing comhub's web staff app
 * (communication-hub origin/main c2bfa2a: WebHeader 61px top bar, 13px control
 * radius, lime primary, lavender nav pill and unread badge, ListTabSwitcher
 * sliding bubble, EmptyState) with minerva/comhubuix extras (KPI tiles, tables,
 * omnibox listbox, app launcher). Spec: .agnt/carehub/ui-refactor/SPEC.md §1–§2,
 * §5.3. No hex colours here — every colour is a token from tokens.css.
 * Page-specific rules live in css/pages/<page>.css, scoped by the page root class.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  background: var(--color-page);
  color: var(--color-foreground);
  -webkit-font-smoothing: antialiased;
}

/* comhub bg-gradient.png approximation (light only); never interactive */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--page-gradient);
}

* {
  border-color: var(--color-border);
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* D8: lime alone fails 1.4.11 on white, so light = dark outline + lime halo; dark = lime outline */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  box-shadow: 0 0 0 5px var(--color-focus-halo);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  accent-color: var(--color-foreground);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 22px;
  line-height: 28px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 18px;
  line-height: 24px;
}

h3 {
  font-size: 15px;
  line-height: 20px;
}

[hidden] {
  display: none !important;
}

svg {
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 200;
  background: var(--color-card);
  color: var(--color-foreground);
  padding: 8px 12px;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-elevated);
}

.skip-link:focus {
  top: 8px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.muted {
  color: var(--color-foreground-secondary);
}

.small {
  font-size: 12px;
  line-height: 16px;
}

.caption {
  font-size: 11px;
  line-height: 14px;
}

.label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.nowrap {
  white-space: nowrap;
}

.num {
  font-variant-numeric: tabular-nums;
}

.right {
  text-align: right;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spacer {
  flex: 1;
}

.danger-text {
  color: var(--color-danger);
}

/* ================================================================== header (comhub WebHeader) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 24px;
  height: var(--header-h);
  padding: 0 16px;
  background: var(--color-surface);
  border-bottom: 3px solid var(--color-border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-foreground);
  font-size: 15px;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 29px;
  height: 29px;
}

.dark .brand img {
  filter: invert(1) hue-rotate(180deg) brightness(1.4);
}

.brand b {
  font-weight: 600;
}

.brand .brand-app {
  margin-left: 4px;
  color: var(--color-foreground-secondary);
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--radius-control);
  color: var(--color-foreground-secondary);
  font-size: 14px;
  white-space: nowrap;
  transition: background var(--transition-duration);
}

.nav-pill:hover {
  text-decoration: none;
  background: var(--color-input);
}

.nav-pill svg {
  width: 20px;
  height: 20px;
}

.nav-pill[aria-current="page"] {
  background: var(--color-nav-active-bg);
  color: var(--color-nav-active-fg);
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 3px;
  border-radius: var(--radius-full);
  background: var(--color-unread-bg);
  color: var(--color-unread-fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.count-badge.mid {
  font-size: 10px;
}

.count-badge.max {
  font-size: 8px;
}

.header-search {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--control-h);
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.user-chip:hover {
  background: var(--color-input);
}

.user-chip .avatar {
  width: 35px;
  height: 35px;
  font-size: 13px;
  background: var(--color-avatar-user);
  color: var(--color-white);
}

.user-chip .who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 220px;
}

.user-chip .who strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}

.user-chip .who span {
  font-size: 12px;
  line-height: 16px;
  color: var(--color-muted);
}

.user-chip > svg {
  width: 16px;
  height: 16px;
  color: var(--color-foreground-secondary);
}

.header-search .search-toggle {
  display: none;
}

/* user menu (comhub SettingsModal as a popover) */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 300px;
  padding: 8px;
  border-radius: var(--radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--color-border);
}

.user-menu-head {
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 6px;
}

.user-menu-head strong {
  display: block;
  font-weight: 600;
}

.user-menu-head .email {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.user-menu-head .chip {
  margin-top: 8px;
}

.user-menu .menu-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px 10px;
}

.user-menu .menu-field .select {
  width: 100%;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--color-foreground);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  background: var(--color-input);
  text-decoration: none;
}

.user-menu-item svg {
  width: 18px;
  height: 18px;
  color: var(--color-foreground-secondary);
}

.user-menu-item .switch {
  margin-left: auto;
}

.user-menu-item .ext {
  margin-left: auto;
  width: 14px;
  height: 14px;
}

.user-menu hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 6px 0;
}

.user-menu-foot {
  padding: 8px 10px 4px;
  font-size: 11px;
  line-height: 14px;
  color: var(--color-muted);
}

/* bottom tab bar (PWA) — phones only */
.tabbar {
  display: none;
}

/* ================================================================== page container */
.content {
  display: block;
  padding: 8px;
  min-height: calc(100vh - var(--header-h));
}

.content:focus {
  outline: none;
}

.content.full {
  padding: 0;
  height: calc(100vh - var(--header-h));
  min-height: 0;
  overflow: hidden;
}

.page-narrow {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 8px 32px;
}

.page-narrow.wide {
  max-width: 1280px;
}

#flash:empty {
  display: none;
}

/* legacy page head (pages not yet moved to .app-header) */
.page-head {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: 22px;
  line-height: 28px;
}

.page-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-foreground-secondary);
}

.page-head .actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* app header (templates/web/_app_header.html) */
.app-header {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.app-header-text {
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-foreground-secondary);
}

.breadcrumb svg {
  width: 12px;
  height: 12px;
}

.app-header p {
  margin: 2px 0 0;
  font-size: 13px;
}

.app-header-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.app-header-actions:empty {
  display: none;
}

/* ================================================================== controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--color-input);
  color: var(--color-foreground);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--transition-duration),
    border-color var(--transition-duration);
}

.btn:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--color-input) 80%, var(--color-foreground) 6%);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn.primary {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

.btn.primary:hover {
  background: var(--color-primary-hover);
}

.btn.secondary {
  background: var(--color-input);
}

.btn.outline {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.btn.outline:hover {
  border-color: var(--color-foreground-secondary);
  background: var(--color-surface);
}

.btn.ghost {
  background: transparent;
}

.btn.ghost:hover {
  background: var(--color-input);
}

.btn.danger {
  background: var(--color-danger);
  color: var(--color-white);
}

.btn.danger:hover {
  background: color-mix(in srgb, var(--color-danger) 88%, var(--color-foreground));
}

.btn.link {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-link);
  font-weight: 500;
}

.btn.link:hover {
  background: none;
  text-decoration: underline;
}

.btn.md {
  height: var(--control-h-sm);
  padding: 0 14px;
}

.btn.sm {
  height: var(--control-h-xs);
  padding: 0 12px;
  font-size: 13px;
}

.btn.block {
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--color-input);
  color: var(--color-muted);
  border-color: transparent;
  cursor: not-allowed;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--color-input);
  color: var(--color-foreground);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--color-input) 80%, var(--color-foreground) 6%);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn.ghost {
  background: transparent;
}

.icon-btn.ghost:hover {
  background: var(--color-input);
}

.icon-btn.outline {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.icon-btn.round {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
}

.icon-btn.round svg {
  width: 16px;
  height: 16px;
}

.icon-btn.sm {
  width: var(--control-h-xs);
  height: var(--control-h-xs);
}

.icon-btn.sm svg {
  width: 16px;
  height: 16px;
}

.icon-btn[disabled] {
  color: var(--color-muted);
  cursor: not-allowed;
}

.input,
.select,
.textarea {
  height: var(--control-h);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--color-input);
  color: var(--color-foreground);
  font-size: 14px;
  min-width: 0;
}

.input.md,
.select.md {
  height: var(--control-h-sm);
}

.textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 14px;
  line-height: 20px;
  resize: vertical;
}

.select {
  padding-right: 36px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-foreground-secondary) 50%),
    linear-gradient(135deg, var(--color-foreground-secondary) 50%, transparent 50%);
  background-position:
    right 18px center,
    right 13px center;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.select.outline,
.input.outline {
  background-color: var(--color-surface);
  border-color: var(--color-border);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-muted);
}

.input[disabled],
.select[disabled],
.textarea[disabled] {
  color: var(--color-muted);
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label,
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-foreground-secondary);
}

.field-error {
  font-size: 12px;
  color: var(--color-danger);
}

.search-field,
.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-field > svg,
.search > svg {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--color-foreground-secondary);
  pointer-events: none;
}

.search-field .input,
.search .input {
  width: 100%;
  padding-left: 36px;
}

.search-field .clear {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-foreground-secondary);
  cursor: pointer;
}

.search-field .clear svg {
  width: 17px;
  height: 17px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.filters .grow {
  flex: 1 1 260px;
}

.filters .count {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--color-foreground-secondary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.filter-bar .input,
.filter-bar .select,
.filter-bar .btn {
  height: var(--control-h-sm);
}

.filter-bar .grow {
  flex: 1 1 240px;
}

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-chip);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-foreground-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

/* segmented control (comhub ListTabSwitcher: sliding lavender bubble) */
.segmented {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  height: var(--segment-h);
  padding: 4px;
  gap: 0;
  border-radius: var(--radius-control);
  background: var(--color-input);
  isolation: isolate;
}

.segmented .segmented-bubble {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  z-index: -1;
  border-radius: 10px;
  background: var(--color-segment-bubble);
  transition:
    transform 250ms var(--ease-out-cubic),
    width 250ms var(--ease-out-cubic);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--color-foreground-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.segmented button[aria-selected="true"],
.segmented button[aria-pressed="true"] {
  color: var(--color-segment-active-fg);
}

/* markup without a bubble element (older pages) paints the bubble on the button */
.segmented:not(.has-bubble) button[aria-selected="true"],
.segmented:not(.has-bubble) button[aria-pressed="true"] {
  background: var(--color-segment-bubble);
}

.segmented.sm {
  height: var(--control-h-xs);
  padding: 2px;
}

.segmented.sm .segmented-bubble {
  top: 2px;
  bottom: 2px;
  border-radius: 9px;
}

.segmented.sm button {
  padding: 0 10px;
  font-size: 13px;
}

.segmented.full {
  display: flex;
}

.segmented.full button {
  flex: 1;
}

/* switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  margin: 0;
  border-radius: var(--radius-full);
  background: var(--color-input);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-duration);
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-duration);
}

.switch input:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.switch input:checked::after {
  transform: translateX(16px);
  background: var(--color-primary-foreground);
}

/* ================================================================== surfaces */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card.pad,
.card-pad {
  padding: 16px;
}

.card.flat {
  box-shadow: none;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 8px;
}

.card-head h2 {
  font-size: 18px;
  line-height: 24px;
}

.card-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-foreground-secondary);
}

.card-head .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-body {
  padding: 0 16px 16px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.section-label svg {
  width: 14px;
  height: 14px;
}

.grid {
  display: grid;
  gap: 8px;
}

.grid.kpis {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 8px;
}

.grid.kpis.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

.grid.halves {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.thirds {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.grid > * {
  min-width: 0;
}

/* KPI tile (minerva StatCard, comhub density) */
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-foreground);
  text-align: left;
  font: inherit;
  text-decoration: none;
}

a.kpi:hover,
button.kpi:hover {
  text-decoration: none;
  border-color: var(--color-foreground-secondary);
}

button.kpi {
  cursor: pointer;
}

button.kpi[aria-pressed="true"] {
  border: 2px solid var(--color-foreground);
  padding: 11px;
}

.kpi .kpi-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.kpi .kpi-icon {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 16px;
  height: 16px;
  color: var(--color-foreground-secondary);
}

.kpi .kpi-value {
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi .kpi-sub,
.kpi .kpi-helper {
  font-size: 11px;
  line-height: 14px;
  color: var(--color-foreground-secondary);
}

.kpi a.kpi-link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.meter {
  height: 6px;
  margin-top: 6px;
  border-radius: var(--radius-full);
  background: var(--color-input);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-foreground);
}

/* ================================================================== chips, badges, pills */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  background: var(--color-input);
  color: var(--color-foreground-secondary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.chip svg {
  width: 12px;
  height: 12px;
}

.chip.sm {
  height: 18px;
  padding: 1px 6px;
  font-size: 11px;
}

.chip.pending {
  background: var(--color-status-pending-bg);
  color: var(--color-status-pending-fg);
}

.chip.completed {
  background: var(--color-status-completed-bg);
  color: var(--color-status-completed-fg);
}

.chip.archived {
  background: var(--color-status-archived-bg);
  color: var(--color-status-archived-fg);
}

.chip.danger {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
  color: var(--color-danger);
}

.chip.warning {
  background: color-mix(in srgb, var(--color-warning) 10%, transparent);
  color: var(--color-warning);
}

.chip.info {
  background: color-mix(in srgb, var(--color-link) 10%, transparent);
  color: var(--color-link);
}

.chip.lime {
  background: color-mix(in srgb, var(--color-primary) 25%, transparent);
  color: var(--color-foreground);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-chip);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill.open,
.status-pill.pending {
  background: var(--color-status-pending-bg);
  color: var(--color-status-pending-fg);
}

.status-pill.completed {
  background: var(--color-status-completed-bg);
  color: var(--color-status-completed-fg);
}

.status-pill.archived {
  background: var(--color-status-archived-bg);
  color: var(--color-status-archived-fg);
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.priority.high {
  color: var(--color-priority-high);
}

.priority.med {
  color: var(--color-priority-med);
}

.priority.low {
  color: var(--color-priority-low);
}

.office-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 10px;
  line-height: 12px;
  font-weight: 500;
  color: var(--office-color, var(--office-default));
  background: color-mix(in srgb, var(--office-color, var(--office-default)) 10%, transparent);
  white-space: nowrap;
}

/* legacy badge (pages not yet migrated to .chip / .status-pill) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-chip);
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1;
  color: var(--color-foreground-secondary);
  background: var(--color-input);
}

.badge.success,
.badge.active,
.badge.ok,
.badge.completed,
.badge.scheduled,
.badge.activated {
  color: var(--color-status-completed-fg);
  background: var(--color-status-completed-bg);
}

.badge.pending,
.badge.outreach,
.badge.needsOutreach,
.badge.upcoming {
  color: var(--color-status-pending-fg);
  background: var(--color-status-pending-bg);
}

.badge.archived,
.badge.inactive,
.badge.merged,
.badge.neutral,
.badge.dataIssue,
.badge.cancelled {
  color: var(--color-status-archived-fg);
  background: var(--color-status-archived-bg);
}

.badge.danger,
.badge.critical,
.badge.no_show {
  color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
}

.badge.warning,
.badge.low {
  color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 10%, transparent);
}

.badge.info,
.badge.review,
.badge.needsReview {
  color: var(--color-link);
  background: color-mix(in srgb, var(--color-link) 10%, transparent);
}

.badge.lock {
  color: var(--color-foreground-secondary);
  background: var(--color-input);
  border-color: transparent;
  cursor: help;
}

.badge.lock svg {
  width: 11px;
  height: 11px;
}

/* legacy count badge (old nav markup) → same lavender circle */
.badge-count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--color-unread-bg);
  color: var(--color-unread-fg);
  font-size: 11px;
  font-weight: 600;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
}

.dot.alert {
  background: var(--color-badge-alert);
}

.pill-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-foreground-secondary);
  white-space: nowrap;
}

.pill-status .dot {
  width: 7px;
  height: 7px;
}

.pill-status.stale .dot {
  background: var(--color-warning);
}

.pill-status.paused .dot {
  background: var(--color-muted);
}

/* ================================================================== avatar */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--office-color, var(--office-default));
  color: var(--color-avatar-fg);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.avatar.xs {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

.avatar.c0 {
  --office-color: var(--color-midnight);
}

.avatar.c1 {
  --office-color: var(--color-link);
}

.avatar.c2 {
  --office-color: var(--color-olive);
}

.avatar.c3 {
  --office-color: var(--color-blue-dark);
}

.avatar.c4 {
  --office-color: var(--color-olive-dark);
}

.avatar.c5 {
  --office-color: var(--color-lavender-80);
}

.dark .avatar.c0 {
  --office-color: var(--color-foreground-secondary);
}

.avatar.unlinked {
  background: var(--color-input);
  color: var(--color-muted);
}

/* ================================================================== tables */
.table-wrap {
  overflow-x: auto;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  height: 47px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--color-muted);
  padding: 0 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table th .sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.table th .sort svg {
  width: 14px;
  height: 14px;
}

.table th[aria-sort="ascending"],
.table th[aria-sort="descending"] {
  color: var(--color-foreground);
}

.table td {
  height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr.clickable {
  cursor: pointer;
}

.table tbody tr.clickable:hover,
.table tbody tr.clickable:focus-within {
  background: var(--color-input);
}

.table tbody tr[aria-selected="true"] td:first-child {
  box-shadow: inset 4px 0 0 var(--color-foreground-secondary);
}

.table .cell-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table .cell-person a {
  color: var(--color-foreground);
  font-weight: 500;
}

.table .sub {
  display: block;
  font-size: 12px;
  color: var(--color-foreground-secondary);
}

.table th.right,
.table td.right {
  text-align: right;
}

.table-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-foreground-secondary);
}

.table-foot .spacer {
  flex: 1;
}

/* ================================================================== list rows */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rows > li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.rows > li:last-child {
  border-bottom: 0;
}

.rows .grow {
  flex: 1;
  min-width: 0;
}

.rows .title {
  font-weight: 500;
  color: var(--color-foreground);
}

.rows .meta {
  font-size: 12px;
  color: var(--color-foreground-secondary);
}

.rows .meta svg,
.rows .chan svg {
  width: 14px;
  height: 14px;
}

.rows .chan {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-input);
  color: var(--color-foreground-secondary);
  flex: none;
}

/* property list: label over value */
.props {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 0;
}

.props.cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.props dt {
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.props dd {
  margin: 2px 0 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* ================================================================== states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  margin: 0 auto;
  padding: 32px 16px;
  text-align: center;
}

.empty-state .art {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--color-lavender) 35%, transparent), transparent 70%);
}

.empty-state .art img {
  max-width: 64px;
  max-height: 64px;
}

.dark .empty-state .art img {
  filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

.empty-state .art svg {
  width: 32px;
  height: 32px;
  color: var(--color-foreground-secondary);
}

.empty-state .title {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--color-foreground);
}

.empty-state .subtitle {
  font-size: 13px;
  color: var(--color-foreground-secondary);
}

.empty-state .btn {
  margin-top: 8px;
}

/* legacy */
.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 32px 16px;
  text-align: center;
  color: var(--color-foreground-secondary);
  font-size: 13px;
}

.empty svg {
  width: 28px;
  height: 28px;
  opacity: 0.6;
}

.skeleton {
  display: block;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--color-input) 0%,
    color-mix(in srgb, var(--color-input) 50%, var(--color-card)) 50%,
    var(--color-input) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton.tile {
  height: 132px;
  border-radius: var(--radius-card);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* comhub lime ActivityIndicator */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid var(--color-input);
  border-top-color: var(--color-primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--color-danger) 8%, var(--color-card));
  color: var(--color-danger);
  border: 1px solid color-mix(in srgb, var(--color-danger) 25%, transparent);
  font-size: 13px;
  margin-bottom: 8px;
}

.alert svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.alert.info {
  background: var(--color-chat-blue);
  color: var(--color-foreground);
  border-color: color-mix(in srgb, var(--color-link) 25%, transparent);
}

.dark .alert.info {
  background: color-mix(in srgb, var(--color-link) 14%, var(--color-card));
}

/* tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  width: max-content;
  max-width: 280px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--color-tooltip-bg);
  color: var(--color-tooltip-fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow-elevated);
  white-space: normal;
  pointer-events: none;
}

/* ================================================================== overlays: menu, dialog, toast */
.menu {
  position: fixed;
  z-index: 90;
  min-width: 200px;
  max-width: 320px;
  padding: 6px;
  border-radius: var(--radius-control);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-elevated);
}

.menu [role="menuitem"] {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-foreground);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.menu [role="menuitem"]:hover,
.menu [role="menuitem"]:focus {
  background: var(--color-input);
  outline: none;
}

.menu [role="menuitem"].danger {
  color: var(--color-danger);
}

.menu [role="menuitem"][aria-disabled="true"] {
  color: var(--color-muted);
  cursor: not-allowed;
}

.menu [role="menuitem"] svg {
  width: 16px;
  height: 16px;
  color: var(--color-foreground-secondary);
}

dialog.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-dialog);
  background: var(--color-card);
  color: var(--color-foreground);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}

dialog.dialog.sm {
  width: min(420px, calc(100vw - 32px));
}

dialog.dialog.lg {
  width: min(760px, calc(100vw - 32px));
}

dialog.dialog.sheet {
  margin: 0 0 0 auto;
  width: min(380px, 100vw);
  height: 100vh;
  max-height: 100vh;
  border-radius: var(--radius-dialog) 0 0 var(--radius-dialog);
}

dialog.dialog::backdrop {
  background: var(--color-overlay);
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 16px 0 24px;
  border-bottom: 1px solid var(--color-border);
}

.dialog-head h2 {
  flex: 1;
  font-size: 18px;
  line-height: 24px;
}

.dialog-body {
  padding: 24px;
  overflow: auto;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
}

.dialog-form {
  display: grid;
  gap: 16px;
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 400px;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  background: var(--color-card);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-elevated);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 150ms ease;
}

.toast > svg {
  width: 18px;
  height: 18px;
}

.toast.success > svg {
  color: var(--color-success);
}

.toast.error > svg {
  color: var(--color-danger);
}

.toast.info > svg {
  color: var(--color-link);
}

.toast .msg {
  flex: 1;
}

.toast .btn.link {
  font-size: 13px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.shortcuts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 0;
}

.shortcuts dt {
  display: flex;
  gap: 4px;
  align-items: center;
}

.shortcuts dd {
  margin: 0;
  color: var(--color-foreground-secondary);
}

/* ================================================================== omnibar + combobox listbox */
.omnibar {
  position: relative;
  width: 100%;
  max-width: 560px;
}

.omnibar .omnibar-field {
  position: relative;
  display: flex;
  align-items: center;
}

.omnibar .omnibar-field > svg {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--color-foreground-secondary);
  pointer-events: none;
}

.omnibar input {
  width: 100%;
  height: var(--control-h);
  padding: 0 64px 0 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--color-input);
  color: var(--color-foreground);
  font-size: 14px;
}

.omnibar input::placeholder {
  color: var(--color-muted);
}

.omnibar input::-webkit-search-cancel-button {
  display: none;
}

.omnibar .omnibar-hint {
  position: absolute;
  right: 10px;
  pointer-events: none;
}

.omnibar .omnibar-clear {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-foreground-secondary);
  cursor: pointer;
}

.omnibar .omnibar-clear svg {
  width: 17px;
  height: 17px;
}

.cbx-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 80;
  width: max(100%, 560px);
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}

.cbx-pop.fit {
  width: 100%;
}

.cbx-scroll {
  flex: 1;
  overflow: auto;
  padding: 6px;
}

.cbx-scroll.loading {
  opacity: 0.6;
}

.cbx-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cbx-group + .cbx-group {
  margin-top: 4px;
}

.cbx-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.cbx-group-head svg {
  width: 14px;
  height: 14px;
}

.cbx-group-head .total {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
}

.cbx-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--color-foreground);
}

.cbx-opt[aria-selected="true"] {
  background: var(--color-input);
}

.cbx-opt[aria-disabled="true"] {
  cursor: not-allowed;
}

.cbx-opt[aria-disabled="true"] .cbx-text,
.cbx-opt[aria-disabled="true"] .cbx-icon {
  opacity: 0.55;
}

.cbx-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--color-input);
  color: var(--color-foreground-secondary);
}

.cbx-opt[aria-selected="true"] .cbx-icon {
  background: var(--color-surface);
}

.cbx-icon svg {
  width: 16px;
  height: 16px;
}

.cbx-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cbx-title {
  font-size: 13px;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cbx-title mark {
  background: transparent;
  color: inherit;
  font-weight: 600;
}

.cbx-sub {
  font-size: 11px;
  line-height: 14px;
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cbx-meta {
  flex: none;
}

.cbx-see-all {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--color-link);
  font-size: 13px;
  cursor: pointer;
}

.cbx-see-all[aria-selected="true"] {
  background: var(--color-input);
}

.cbx-note,
.cbx-empty,
.cbx-error {
  padding: 24px;
  text-align: center;
}

.cbx-note {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--color-muted);
  text-align: left;
}

.cbx-empty strong,
.cbx-error strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.cbx-empty span,
.cbx-error span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

.cbx-error .btn.link {
  margin-top: 8px;
  font-size: 13px;
}

.cbx-skel {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 6px 10px;
}

.cbx-skel .skeleton {
  flex: 1;
}

.cbx-skel .skeleton.sq {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.cbx-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 4px 12px;
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-muted);
}

/* combobox used inside forms (task dialog, employer picker) */
.combo {
  position: relative;
}

.combo .input {
  width: 100%;
}

/* omnibar mobile sheet */
.omnibar-sheet {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--color-surface);
}

.omnibar-sheet .sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.omnibar-sheet .omnibar {
  max-width: none;
  flex: 1;
}

.omnibar-sheet .cbx-pop {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  max-width: none;
  max-height: none;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

/* ================================================================== responsive */
@media (max-width: 1279px) {
  .nav-pill {
    width: var(--control-h);
    padding: 0;
    justify-content: center;
  }

  .nav-pill .nav-label {
    display: none;
  }

  .nav-pill .count-badge {
    position: absolute;
    top: 1px;
    right: 1px;
  }
}

@media (max-width: 1100px) {
  .user-chip .who {
    display: none;
  }

  .grid.kpis.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .grid.two,
  .grid.halves,
  .grid.thirds {
    grid-template-columns: 1fr;
  }

  .topbar {
    column-gap: 12px;
  }
}

@media (max-width: 767px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .topbar .nav-pills,
  .brand .brand-text,
  .header-search .omnibar {
    display: none;
  }

  .header-search {
    justify-content: flex-end;
  }

  .header-search .search-toggle {
    display: inline-grid;
  }

  .content {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
    min-height: calc(100vh - var(--header-h));
  }

  .content.full {
    height: calc(100vh - var(--header-h) - var(--tabbar-h) - env(safe-area-inset-bottom));
    padding-bottom: 0;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(var(--tabbar-cols, 5), 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 4px env(safe-area-inset-bottom);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
  }

  .tabbar a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--color-foreground-secondary);
    font-size: 10px;
    line-height: 12px;
  }

  .tabbar a:hover {
    text-decoration: none;
  }

  .tabbar .tab-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 52px;
    height: 32px;
    border-radius: var(--radius-full);
  }

  .tabbar svg {
    width: 22px;
    height: 22px;
  }

  .tabbar a[aria-current="page"] {
    color: var(--color-foreground);
  }

  .tabbar a[aria-current="page"] .tab-icon {
    background: var(--color-nav-active-bg);
  }

  .tabbar .tab-dot {
    position: absolute;
    top: 4px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-badge-alert);
  }

  .tabbar .tab-count {
    position: absolute;
    top: 0;
    right: 8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    background: var(--color-badge-alert);
    color: var(--color-white);
    font-size: 10px;
    line-height: 16px;
    font-weight: 600;
    text-align: center;
  }

  .toast-stack {
    left: 16px;
    bottom: calc(var(--tabbar-h) + 16px);
  }

  .user-menu {
    position: fixed;
    top: calc(var(--header-h) + 4px);
    right: 8px;
    width: min(300px, calc(100vw - 16px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* task dialog: comboboxes need to overflow the dialog body */
dialog.dialog.task-dialog,
dialog.dialog.task-dialog .dialog-inner,
dialog.dialog.task-dialog .dialog-body {
  overflow: visible;
}

/* nav tooltips only matter once the pills are icon-only */
@media (min-width: 1280px) {
  .nav-pill[data-tooltip]::after {
    display: none;
  }
}

/* ================================================================== Customize view sheet (customize.js) */
dialog.dialog.customize-sheet {
  width: min(420px, 100vw);
}

/* Phones: side sheets take the whole width (the UA's dialog max-width would otherwise leave a strip of page). */
@media (max-width: 480px) {
  dialog.dialog.sheet,
  dialog.dialog.customize-sheet {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
    border-radius: 0;
  }
}

.customize-sheet .dialog-inner {
  height: 100%;
}

.customize-sheet .dialog-body {
  flex: 1;
  padding: 16px 24px 24px;
}

.cz-target {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.cz-help {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 18px;
}

.cz-section {
  padding: 16px 0 4px;
  border-bottom: 1px solid var(--color-border);
}

.cz-section:last-child {
  border-bottom: 0;
}

.cz-section > h3 {
  margin: 0 0 4px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.cz-note {
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 16px;
}

.cz-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 0;
}

.cz-row.child {
  padding-left: 16px;
}

.cz-label {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
}

.cz-row.locked .cz-label {
  cursor: default;
}

.cz-lock,
.cz-src {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-foreground-secondary);
}

.cz-lock svg {
  width: 12px;
  height: 12px;
}

.cz-row .switch input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cz-row .switch input:focus-visible {
  outline: 2px solid var(--color-foreground);
  outline-offset: 2px;
}

.cz-row .cz-state {
  width: 104px;
  flex: none;
}

.cz-lock-btn {
  flex: none;
  background: transparent;
  color: var(--color-foreground-secondary);
}

.cz-lock-btn.on {
  color: var(--color-primary-foreground);
  background: var(--color-primary);
}

.cz-lock-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.cz-skel {
  display: grid;
  gap: 16px;
  padding-top: 16px;
}

.cz-foot {
  align-items: center;
}

/* ================================================================== conversation → member link flow (link-dialog.js) */
.btn.link.danger-link {
  color: var(--color-danger);
}

.link-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.link-dialog .dialog-body > .dialog-form,
.link-flow .dialog-form {
  gap: 14px;
}

.link-steps {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: link-step;
  font-size: 12px;
  color: var(--color-muted);
}

.link-steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  counter-increment: link-step;
  white-space: nowrap;
}

.link-steps li::before {
  content: counter(link-step);
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-input);
  color: var(--color-foreground-secondary);
  font-size: 11px;
  font-weight: 600;
}

.link-steps li + li::after {
  order: -1;
  content: "";
  width: 12px;
  height: 1px;
  background: var(--color-border);
}

.link-steps li.current {
  color: var(--color-foreground);
  font-weight: 600;
}

.link-steps li.current::before {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

.link-steps li.done::before {
  background: var(--color-status-completed-bg);
  color: var(--color-status-completed-fg);
}

.link-lead,
.link-summary {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.link-summary {
  font-weight: 600;
}

.link-hint {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-foreground-secondary);
}

.link-member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
}

.link-member-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.link-member-text .name {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.link-member-text .sub {
  font-size: 12px;
  color: var(--color-foreground-secondary);
}

.link-conv {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 13px;
}

.link-conv .muted {
  color: var(--color-foreground-secondary);
}

.link-sender {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.link-sender svg,
.link-facts svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.link-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}

.link-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--color-foreground);
  flex: none;
}

.alert.warn {
  background: color-mix(in srgb, var(--color-warning) 9%, var(--color-card));
  color: var(--color-foreground);
  border-color: color-mix(in srgb, var(--color-warning) 35%, transparent);
}

.alert.warn svg {
  color: var(--color-warning);
}

.alert[hidden] {
  display: none;
}

.link-facts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 18px;
}

.link-facts li {
  display: flex;
  gap: 8px;
}

.link-facts svg {
  margin-top: 2px;
  color: var(--color-success);
}

.link-pick {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(420px, 55vh);
  overflow: auto;
}

.link-pick li + li {
  border-top: 1px solid var(--color-border-subtle);
}

.link-pick .conv-row {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--color-foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.link-pick .conv-row:hover,
.link-pick .conv-row:focus-visible {
  background: var(--color-input);
}

.link-pick .conv-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.link-pick .line1,
.link-pick .line2 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.link-pick .name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-pick .chan {
  flex: 1;
  font-size: 11px;
  color: var(--color-muted);
}

.link-pick .time {
  font-size: 11px;
  color: var(--color-muted);
  white-space: nowrap;
}

.link-pick .line2 {
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-pick .line2 svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.link-dialog .dialog-foot {
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .link-dialog .dialog-body {
    padding: 16px;
  }

  .link-steps li:not(.current) {
    font-size: 0;
    gap: 0;
  }

  .link-steps li:not(.current)::after {
    margin-right: 6px;
  }
}

/* The member search results flow inside the dialog instead of floating over (and being clipped by) its body. */
.link-dialog .combo .cbx-pop {
  position: static;
  margin-top: 6px;
  max-height: min(48vh, 400px);
  box-shadow: none;
}

/* Tab fallback notice (apps/web/views.page_tabs): a ?tab= the user may not open or has hidden. */
.tab-notice {
  margin-bottom: 12px;
}

/* Site footer with build identity */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  margin-top: 24px;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
}
.build-version {
  font-variant-numeric: tabular-nums;
}
