/*
 * Tekla MCP Hub — base + component styles (ported from Tekla Support)
 * Depends on tokens/tokens.css. Framework-agnostic: React components should
 * apply these class names (or port the rules 1:1 into CSS modules).
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-feature-settings: var(--font-features);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
}

::selection { background: var(--color-selection); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

a { color: var(--color-text-link); text-decoration: none; }
a:hover { color: var(--color-text-link-hover); text-decoration: underline; text-underline-offset: 2px; }

code, kbd, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }

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

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

/* ------------------------------------------------------------------ */
/* Brand lockup                                                        */
/* ------------------------------------------------------------------ */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--color-text); }
.brand__wordmark { height: 14px; width: auto; display: block; }
.brand__divider { width: 1px; height: 14px; background: var(--color-border-strong); }
.brand__product {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  /* The divider's height, so the text shares its centre on whole pixels instead of a taller, fractional line box. */
  line-height: 14px;
  color: var(--color-text-secondary);
}

/* ------------------------------------------------------------------ */
/* Typography helpers                                                  */
/* ------------------------------------------------------------------ */
.title-display { font-size: var(--text-3xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); margin: 0; }
.title-1 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); margin: 0; }
.title-2 { font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); margin: 0; }
.title-3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-snug); margin: 0; }
.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-tertiary);
}
.meta { font-size: var(--text-xs); color: var(--color-text-tertiary); }
/* Inline metadata: items separated by space alone, no separator glyphs */
.meta-list { display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; overflow: hidden; white-space: nowrap; }
.meta-list > * { flex: none; }
.meta-list > :last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.text-secondary { color: var(--color-text-secondary); }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-text);
  --btn-border: var(--color-border-strong);
  --btn-bg-hover: var(--color-bg-muted);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  height: var(--control-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.btn:hover { background: var(--btn-bg-hover); text-decoration: none; color: var(--btn-fg); }
.btn:active { transform: translateY(0.5px); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: var(--icon-md); height: var(--icon-md); flex: none; }

.btn--primary {
  --btn-bg: var(--color-primary);
  --btn-fg: var(--color-primary-fg);
  --btn-border: var(--color-primary);
  --btn-bg-hover: var(--color-primary-hover);
  box-shadow: var(--highlight-top), var(--shadow-xs);
}
.btn--ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--color-text-secondary);
  box-shadow: none;
}
.btn--ghost:hover { --btn-fg: var(--color-text); }
.btn--link {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--color-text-link);
  --btn-bg-hover: transparent;
  height: auto;
  padding: 0;
  box-shadow: none;
}
.btn--link:hover { text-decoration: underline; text-underline-offset: 2px; --btn-fg: var(--color-text-link-hover); }
/* Destructive, outside a confirmation: secondary weight, red text. Solid red only in the confirm dialog. */
.btn--danger-quiet { --btn-fg: var(--tone-danger-fg); }
.btn--danger-quiet:hover { --btn-bg-hover: var(--tone-danger-bg); --btn-border: var(--tone-danger-border); }
.btn--danger {
  --btn-bg: var(--tone-danger-solid);
  --btn-fg: #fff;
  --btn-border: var(--tone-danger-solid);
  --btn-bg-hover: var(--red-700);
}
.btn--ai {
  --btn-bg: var(--tone-ai-bg);
  --btn-fg: var(--tone-ai-fg);
  --btn-border: var(--tone-ai-border);
  --btn-bg-hover: var(--tone-ai-bg);
  box-shadow: none;
}
.btn--ai:hover { border-color: var(--tone-ai-solid); }
.btn--sm { height: var(--control-sm); padding: 0 var(--space-2); font-size: var(--text-sm); }
.btn--lg { height: var(--control-lg); padding: 0 var(--space-4); }
.btn--icon { width: var(--control-md); padding: 0; }
.btn--icon.btn--sm { width: var(--control-sm); }

.btn-group { display: inline-flex; gap: var(--space-2); flex-wrap: wrap; }

/* ------------------------------------------------------------------ */
/* Form controls                                                       */
/* ------------------------------------------------------------------ */
.field { display: grid; gap: var(--space-1-5); }
.field__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }
.field__hint { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.field__error { font-size: var(--text-xs); color: var(--tone-danger-fg); }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  box-shadow: var(--shadow-inset);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.textarea { padding: var(--space-2) var(--space-3); min-height: 88px; resize: vertical; line-height: var(--leading-normal); }
.textarea.mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.input::placeholder, .textarea::placeholder { color: var(--color-text-disabled); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-text-disabled); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}
.input[aria-invalid="true"] { border-color: var(--tone-danger-solid); }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg { position: absolute; left: var(--space-3); width: var(--icon-md); height: var(--icon-md); color: var(--color-text-tertiary); pointer-events: none; }
.search .input { padding-left: calc(var(--space-3) + var(--icon-md) + var(--space-2)); padding-right: 44px; }
.search kbd { position: absolute; right: var(--space-2); }

kbd {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 var(--space-1-5);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--color-bg-subtle);
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

/* Segmented choice — 2–4 mutually exclusive options */
.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--color-bg-muted);
  border-radius: var(--radius-sm);
}
.segmented button {
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--space-1-5);
}
.segmented button[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* Switch */
.switch {
  position: relative;
  width: 32px; height: 18px;
  flex: none;
  appearance: none;
  margin: 0;
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-out);
}
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-out);
}
.switch:checked { background: var(--color-accent); }
.switch:checked::after { transform: translateX(14px); }

/* ------------------------------------------------------------------ */
/* Badges & state indicators                                           */
/* ------------------------------------------------------------------ */
.badge {
  --badge-fg: var(--tone-neutral-fg);
  --badge-bg: var(--tone-neutral-bg);
  --badge-dot: var(--tone-neutral-solid);

  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  line-height: 1;
}
.badge--dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--badge-dot);
}
.badge svg { width: 12px; height: 12px; }
.badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--color-border); }

.badge--info    { --badge-fg: var(--tone-info-fg);    --badge-bg: var(--tone-info-bg);    --badge-dot: var(--tone-info-solid); }
.badge--success { --badge-fg: var(--tone-success-fg); --badge-bg: var(--tone-success-bg); --badge-dot: var(--tone-success-solid); }
.badge--warning { --badge-fg: var(--tone-warning-fg); --badge-bg: var(--tone-warning-bg); --badge-dot: var(--tone-warning-solid); }
.badge--danger  { --badge-fg: var(--tone-danger-fg);  --badge-bg: var(--tone-danger-bg);  --badge-dot: var(--tone-danger-solid); }
.badge--ai      { --badge-fg: var(--tone-ai-fg);      --badge-bg: var(--tone-ai-bg);      --badge-dot: var(--tone-ai-solid); }


/* ------------------------------------------------------------------ */
/* Avatar                                                              */
/* ------------------------------------------------------------------ */
.avatar {
  --size: 24px;
  display: inline-grid;
  place-items: center;
  width: var(--size); height: var(--size);
  flex: none;
  border-radius: 50%;
  background: var(--color-bg-emphasis);
  color: var(--color-text-secondary);
  font-size: calc(var(--size) * 0.42);
  font-weight: var(--weight-semibold);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { --size: 20px; }
.avatar--lg { --size: 32px; }
.avatar--ai { background: var(--tone-ai-bg); color: var(--tone-ai-fg); box-shadow: inset 0 0 0 1px var(--tone-ai-border); }
.avatar--ai svg { width: 60%; height: 60%; }
.avatar--empty { background: transparent; border: 1px dashed var(--color-border-strong); }

.person { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Cards, panels, dividers                                             */
/* ------------------------------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}
.card__body { padding: var(--space-4); }
.divider { height: 1px; background: var(--color-border); border: 0; margin: var(--space-4) 0; }

/* ------------------------------------------------------------------ */
/* Banners (incident, stale page)                                      */
/* ------------------------------------------------------------------ */
.banner {
  --banner-fg: var(--tone-info-fg);
  --banner-bg: var(--tone-info-bg);
  --banner-border: var(--tone-info-border);
  --banner-text: var(--tone-info-text);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--banner-border);
  border-radius: var(--radius-md);
  background: var(--banner-bg);
  color: var(--banner-text);
  font-size: var(--text-sm);
}
.banner a { color: inherit; font-weight: var(--weight-medium); text-decoration: underline; text-underline-offset: 2px; }
.banner > svg { width: var(--icon-md); height: var(--icon-md); color: var(--banner-fg); flex: none; margin-top: 2px; }
.banner__title { font-weight: var(--weight-semibold); color: var(--banner-fg); }
.banner__actions { margin-left: auto; display: flex; gap: var(--space-2); flex: none; }
.banner--warning { --banner-fg: var(--tone-warning-fg); --banner-bg: var(--tone-warning-bg); --banner-border: var(--tone-warning-border); --banner-text: var(--tone-warning-text); }
.banner--danger  { --banner-fg: var(--tone-danger-fg);  --banner-bg: var(--tone-danger-bg);  --banner-border: var(--tone-danger-border);  --banner-text: var(--tone-danger-text); }
/* Full-bleed incident banner at the top of the app */
.banner--incident { border-radius: 0; border-width: 0 0 1px; }

/* ------------------------------------------------------------------ */
/* App shell                                                           */
/* ------------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-3);
  background: var(--color-bg-subtle);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}
.sidebar__head { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 var(--space-2); }
.sidebar__section { display: grid; gap: 1px; }
.sidebar__label { padding: var(--space-2) var(--space-2) var(--space-1); }
.sidebar__foot { margin-top: auto; }

.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  height: 30px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.nav-item svg { width: var(--icon-md); height: var(--icon-md); flex: none; }
.nav-item:hover { background: var(--color-bg-muted); color: var(--color-text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--color-bg-emphasis); color: var(--color-text); }
.nav-item__count { margin-left: auto; font-size: var(--text-xs); color: var(--color-text-tertiary); font-variant-numeric: tabular-nums; }
.nav-item--nested { padding-left: calc(var(--space-2) + var(--icon-md) + var(--space-2)); font-weight: var(--weight-regular); height: 28px; font-size: var(--text-sm); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--topbar-height);
  padding: 0 var(--space-6);
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.breadcrumb { display: flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-sm); color: var(--color-text-tertiary); min-width: 0; }
.breadcrumb a { color: var(--color-text-tertiary); }
.breadcrumb [aria-current] { color: var(--color-text); font-weight: var(--weight-medium); }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-8) var(--space-6) var(--space-16); }

/* ------------------------------------------------------------------ */
/* Tabs & filter chips                                                 */
/* ------------------------------------------------------------------ */
.tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--color-border); overflow-x: auto; }
.tab {
  position: relative;
  padding: var(--space-2) 0 var(--space-3);
  border: 0; background: none;
  color: var(--color-text-tertiary);
  font: inherit; font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { color: var(--color-text); }
.tab[aria-selected="true"] { color: var(--color-text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--color-text); border-radius: 2px; }
.tab__count { margin-left: var(--space-1-5); color: var(--color-text-tertiary); font-weight: var(--weight-regular); font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; gap: var(--space-1-5);
  height: var(--control-sm);
  padding: 0 10px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit; font-size: var(--text-sm);
  cursor: pointer;
}
.chip svg { width: 14px; height: 14px; }
.chip:hover { background: var(--color-bg-muted); color: var(--color-text); }
.chip--active { border-style: solid; border-color: var(--color-border-strong); background: var(--color-surface); color: var(--color-text); }
.chip__value { color: var(--color-accent); font-weight: var(--weight-medium); }


/* ------------------------------------------------------------------ */
/* Menus, popovers, dialogs, toasts, tooltips                          */
/* ------------------------------------------------------------------ */
.menu {
  min-width: 200px;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-md);
}
.menu__item { display: flex; align-items: center; gap: var(--space-2); height: 30px; padding: 0 var(--space-2); border-radius: var(--radius-xs); font-size: var(--text-sm); color: var(--color-text); cursor: pointer; }
.menu__item svg { width: 14px; height: 14px; color: var(--color-text-tertiary); }
.menu__item:hover, .menu__item[data-highlighted] { background: var(--color-bg-muted); }
.menu__item kbd { margin-left: auto; }
.menu__sep { height: 1px; margin: var(--space-1) calc(-1 * var(--space-1)); background: var(--color-border-subtle); }

.dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-xl);
}
.dialog__head { padding: var(--space-5) var(--space-5) 0; }
.dialog__body { padding: var(--space-4) var(--space-5); display: grid; gap: var(--space-4); }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border-subtle); background: var(--color-bg-subtle); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-primary-fg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
}
.toast a { color: inherit; font-weight: var(--weight-semibold); text-decoration: underline; }

.tooltip { padding: var(--space-1) var(--space-2); border-radius: var(--radius-xs); background: var(--color-primary); color: var(--color-primary-fg); font-size: var(--text-xs); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ */
/* Empty & loading states                                              */
/* ------------------------------------------------------------------ */
.empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-6); text-align: center; color: var(--color-text-secondary); }
.empty__icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--space-2); border-radius: var(--radius-md); background: var(--color-bg-muted); color: var(--color-text-secondary); }
.empty__icon svg { width: var(--icon-lg); height: var(--icon-lg); }
.empty strong { color: var(--color-text); font-weight: var(--weight-semibold); }
.empty .btn { margin-top: var(--space-3); }

.skeleton { border-radius: var(--radius-xs); background: linear-gradient(90deg, var(--color-bg-muted) 0%, var(--color-bg-emphasis) 50%, var(--color-bg-muted) 100%); background-size: 200% 100%; animation: skeleton 1.4s var(--ease-in-out) infinite; }
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ */
/* Stat tile (homepage, analytics)                                     */
/* ------------------------------------------------------------------ */
.stat { padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.stat__label { font-size: var(--text-sm); color: var(--color-text-secondary); }
.stat__value { margin-top: var(--space-1); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; line-height: var(--leading-tight); }
.stat__delta { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--color-text-tertiary); }
.stat__delta--good { color: var(--tone-success-fg); }
.stat__delta--bad { color: var(--tone-danger-fg); }

/* ================================================================== */
/* Hub components                                                      */
/* ================================================================== */

/* Account status — icon + label; the shape reads without color.
   ✓ Active   ◷ Pending   ⊘ Disabled */
.state { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-sm); white-space: nowrap; }
.state svg { width: 14px; height: 14px; flex: none; }
.state--active svg   { color: var(--user-active-solid); }
.state--pending      { color: var(--user-pending-fg); font-weight: var(--weight-medium); }
.state--pending svg  { color: var(--user-pending-solid); }
.state--disabled     { color: var(--color-text-tertiary); }
.state--disabled svg { color: var(--user-disabled-solid); }

/* Data source mark — a neutral monogram tile. Sources are identity, not state, so no color. */
.source {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; flex: none;
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-border);
  color: var(--color-text-secondary);
  font-size: 9.5px; font-weight: var(--weight-semibold); letter-spacing: 0.02em;
}
.source--off { background: transparent; box-shadow: inset 0 0 0 1px var(--color-border-subtle); color: var(--color-text-disabled); }
.sources { display: inline-flex; gap: 3px; }

/* Sensitive endpoint marker */
.sensitive { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--sensitive-fg); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.sensitive svg { width: 12px; height: 12px; }

/* Connector health dot, used in nav and the health page */
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--health-ok-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--health-ok-solid) 18%, transparent); }
.pulse--failing { background: var(--health-failing-solid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--health-failing-solid) 18%, transparent); }

/* Page header: title + one-line summary on the left, the page's actions on the right */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-head__sub { margin: var(--space-2) 0 0; color: var(--color-text-secondary); }
.page-head__sub strong { color: var(--color-text); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }

/* Attention line: one quiet sentence about what needs an admin, with the one action */
.attention {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.attention > svg { width: var(--icon-md); height: var(--icon-md); color: var(--user-pending-solid); flex: none; }
.attention strong { color: var(--color-text); font-weight: var(--weight-medium); }
.attention .btn { margin-left: auto; }

/* Toolbar above a list: search + filter chips */
.toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-4) 0 var(--space-3); }
.toolbar .search { width: 260px; }
.toolbar__end { margin-left: auto; font-size: var(--text-xs); color: var(--color-text-tertiary); }

/* Data list — the generic row list (users, endpoints, tokens, calls). Grid columns set per list. */
.list { border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface); }
.list__row {
  display: grid;
  grid-template-columns: var(--list-cols);
  align-items: center;
  gap: var(--space-4);
  min-height: 52px;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border-subtle);
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out);
}
.list__row:first-child { border-top: 0; }
.list__row:not(.list__row--head):hover { background: var(--color-bg-subtle); text-decoration: none; color: var(--color-text); }
.list__row--head { min-height: 36px; background: var(--color-bg-subtle); }
.list__row--head > * { font-size: var(--text-xs); color: var(--color-text-tertiary); font-weight: var(--weight-medium); }
.list__row--muted .who strong, .list__row--muted .num { color: var(--color-text-tertiary); }
.list__row .end { display: flex; justify-content: flex-end; gap: var(--space-1); }
.list__row .right { text-align: right; }
.list__row .btn--ghost { opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.list__row:hover .btn--ghost, .list__row .btn--ghost:focus-visible { opacity: 1; }

/* Person cell: avatar, name, email + meta */
.who { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.who__text { min-width: 0; }
.who strong { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); white-space: nowrap; }
.who__sub { display: flex; gap: var(--space-3); font-size: var(--text-xs); color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who__warn { color: var(--user-pending-fg); }

/* Access cell: source marks + endpoint count */
.access { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--color-text-secondary); white-space: nowrap; }

/* Usage cell: 30-day sparkline + total */
.usage { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); font-size: var(--text-sm); }
.spark { width: 64px; height: 18px; flex: none; color: var(--color-text-disabled); }
.spark rect { fill: currentColor; }
.poor { color: var(--hygiene-poor-fg); font-weight: var(--weight-medium); }

/* Sidebar block showing the connector URL people add to Claude */
.connector { display: grid; gap: var(--space-1); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-bg); box-shadow: inset 0 0 0 1px var(--color-border-subtle); }
.connector__url { display: flex; align-items: center; gap: var(--space-1); }
.connector__url code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--color-text); }
.connector .meta { line-height: var(--leading-snug); }

.nav-item .pulse { margin-left: auto; margin-right: 2px; }
.me { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); }
.me__text { display: grid; line-height: var(--leading-snug); min-width: 0; }
.me__text span { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.me .btn { margin-left: auto; }

.topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.topbar__end .search { width: 240px; }
.topbar__brand { display: none; }

/* Responsive shell */
@media (max-width: 1080px) {
  .list--people { --list-cols: minmax(0, 1fr) 100px 172px 92px 84px !important; }
  .list--people .spark { display: none; }
  .list--people .hide-md { display: none; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--space-4); }
  .topbar__brand { display: inline-flex; }
  .topbar .breadcrumb, .topbar__end .search { display: none; }
  .content { padding: var(--space-6) var(--space-4) var(--space-12); }
  .toolbar .search { width: 100%; }
  .toolbar__end { display: none; }
  .list--people { --list-cols: minmax(0, 1fr) auto !important; }
  .list--people .hide-sm, .list--people .list__row--head { display: none; }
  .attention { flex-wrap: wrap; }
}
.who a { color: inherit; }
.who a:hover { color: inherit; text-decoration: underline; text-decoration-color: var(--color-border-strong); }
.who__sub > :last-child { overflow: hidden; text-overflow: ellipsis; }
.list__row .meta { white-space: nowrap; }
.connector, .connector__url { min-width: 0; }
.who strong .badge { height: 18px; padding: 0 var(--space-1-5); font-size: 11px; }
.usage .num { min-width: 40px; text-align: right; }
.who__text { overflow: hidden; }
.who strong > a { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.list__row--head > * { white-space: nowrap; }
.sidebar > * { flex: none; }
