/* =========================================================================
   MAESTROX — Shared component library
   Buttons, chips, tables, cards, inputs, breadcrumbs, sidebar, page header.
   Built against tokens.css. Theme-agnostic — never reference raw hex.
   ========================================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--fg-1);
  background: var(--bg-content);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }

/* =========================================================================
   APP LAYOUT
   ========================================================================= */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.content {
  background: var(--bg-content);
  min-width: 0;
  padding: var(--s-6) var(--gutter) var(--s-16);
}

.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* =========================================================================
   SIDEBAR — lighter, denser, with collapsible groups
   ========================================================================= */

.sidebar {
  background: var(--bg-sidebar);
  color: var(--fg-on-dark);
  padding: var(--s-5) 0 var(--s-4);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--border-dark);
  margin-bottom: var(--s-4);
}
.sidebar-brand-mark {
  width: 32px; height: 32px;
  background: var(--gold);
  color: var(--fg-on-gold);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  font-style: italic;
}
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--fg-on-dark);
}
.sidebar-brand-name em {
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}

.sidebar-nav { flex: 1; padding: 0 var(--s-3); }

.sidebar-section-label {
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-on-dark-3);
  padding: var(--s-3) var(--s-3) var(--s-2);
}

.sidebar-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 7px var(--s-3);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--fg-on-dark-2);
  letter-spacing: 0.01em;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  cursor: pointer;
  position: relative;
}
.sidebar-item:hover { color: var(--fg-on-dark); background: rgba(243, 234, 212, 0.04); }
.sidebar-item.is-active { color: var(--fg-on-dark); background: rgba(200, 169, 94, 0.10); }
.sidebar-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; background: var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.sidebar-item .icon {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--fg-on-dark-3);
}
.sidebar-item.is-active .icon { color: var(--gold); }
.sidebar-item-label { flex: 1; }
.sidebar-item-badge {
  background: var(--gold);
  color: var(--fg-on-gold);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  min-width: 16px; text-align: center;
}
/* Make the badge clickable when it's wired to the unread popover —
   keeps the same pill look but stops the parent <a> from also
   navigating. Outline ring on focus for keyboard reachability. */
.sidebar-item-badge--button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-item-badge--button:hover { filter: brightness(1.08); }
.sidebar-item-badge--button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
/* Red badge — used for overdue tasks where the count carries an
   "act now" affordance, distinct from neutral-gold counters. */
.sidebar-item-badge--danger {
  background: #b9332b;
  color: #fff;
}

/* Sidebar item wrap — host for the discussion unread popover. The
   popover is position: fixed for predictable z-index above the page
   surface; we just need the wrap to be a stable click-outside boundary. */
.sidebar-item-wrap {
  position: relative;
}

/* Discussion unread popover — anchored next to the badge, lists
   recent unread threads with deep-links to each. Uses fixed
   positioning anchored on the right edge of the (collapsed or
   expanded) sidebar so it always sits over the main content area. */
.discussion-unread-popover {
  position: fixed;
  left: calc(var(--sidebar-w, 220px) + 8px);
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  max-height: 70vh;
  background: var(--bg-card, #FFFFFF);
  border: 1px solid var(--rule, #d9d2c0);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  z-index: 10400;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink, #1a1a1a);
}
.discussion-unread-popover[hidden] { display: none; }
.discussion-unread-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule, #d9d2c0);
}
.discussion-unread-popover__title {
  font-family: var(--font-display, serif);
  font-size: 16px;
  font-weight: 600;
}
.discussion-unread-popover__close {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft, #666);
  padding: 0 4px;
}
.discussion-unread-popover__close:hover { color: var(--ink, #1a1a1a); }
.discussion-unread-popover__list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  flex: 1;
}
.discussion-unread-popover__item {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.discussion-unread-popover__item:hover {
  background: rgba(192, 162, 107, 0.10);
}
.discussion-unread-popover__item:last-child { border-bottom: 0; }
.discussion-unread-popover__item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.discussion-unread-popover__item-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.discussion-unread-popover__item-count {
  background: var(--gold);
  color: var(--fg-on-gold, #1a1a1a);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill, 999px);
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.discussion-unread-popover__item-meta {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.discussion-unread-popover__all {
  display: block;
  padding: 10px 14px;
  border-top: 1px solid var(--rule, #d9d2c0);
  text-align: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mx2-gold-deep, #876e51);
  text-decoration: none;
  font-weight: 600;
}
.discussion-unread-popover__all:hover {
  background: rgba(192, 162, 107, 0.10);
}

/* Per-org unread chip on the Mx2 client picker. Mirrors the NEW chip
   shown on individual discussion rows. */
.discussion-org-row__unread-chip {
  margin-left: 8px;
  font-size: 10px;
  vertical-align: middle;
}
.discussion-org-row--unread .discussion-org-row__name {
  font-weight: 600;
}

.sidebar-group { margin-top: var(--s-1); }
.sidebar-group-head {
  display: flex;
  align-items: stretch;
}
.sidebar-group-head > .sidebar-item {
  flex: 1;
  min-width: 0;
}

/* Click-driven submenu reveal (2026-05-26 rev). Hover/focus-within
   reveal was scrapped per Drew — sidebar would jump when the cursor
   crossed it incidentally. Now:
   - Parent label stays clickable + navigates to its own page.
   - A small + toggle button sits next to the label and expands the
     submenu on click. Rotates 45° → × when open.
   - Server still stamps `.is-open` when the active page lives inside
     the group, so navigating within a workspace keeps the children
     auto-expanded without user effort. */
.sidebar-group-children {
  margin-left: var(--s-6);
  margin-top: 2px;
  display: none;
}
.sidebar-group.is-open .sidebar-group-children {
  display: block;
}
.sidebar-group-children .sidebar-item { font-size: 12.5px; padding-top: 5px; padding-bottom: 5px; }

/* Submenu toggle button. Lives inside .sidebar-group-head next to
   the parent link. Small + sign that rotates to × when the group is
   open. Hover gets a subtle background. CSP-safe — JS in
   mx2-sidebar.js binds the click handler. */
.sidebar-group-toggle {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-right: 2px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}
.sidebar-group-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-group.is-open .sidebar-group-toggle {
  transform: rotate(45deg);
  opacity: 0.85;
}

.sidebar-user {
  margin-top: auto;
  padding: var(--s-4) var(--s-4) 0;
  border-top: 1px solid var(--border-dark);
  display: flex; align-items: center; gap: var(--s-3);
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #d4a76a, #8a5a2a);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12.5px; font-weight: 500;
  color: var(--fg-on-dark);
  line-height: 1.2;
}
.sidebar-user-role {
  font-size: 9.5px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-on-dark-3);
  margin-top: 2px;
}
.sidebar-signout {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4) 0;
  font-size: 11px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--fg-on-dark-3);
  cursor: pointer;
  transition: color var(--dur-fast);
}
.sidebar-signout:hover { color: var(--gold); }
.sidebar-signout .icon { width: 13px; height: 13px; }

/* =========================================================================
   PAGE HEADER — compact, breadcrumb-first
   ========================================================================= */

.breadcrumb {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-meta);
  font-family: var(--font-body);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: var(--s-3);
}
.breadcrumb a { color: var(--fg-3); transition: color var(--dur-fast); }
.breadcrumb a:hover { color: var(--fg-1); }
.breadcrumb .sep { color: var(--fg-4); font-size: 9px; }
.breadcrumb .current { color: var(--fg-1); font-weight: 600; }

.page-header {
  margin-bottom: var(--s-6);
}
.page-header.compact { margin-bottom: var(--s-5); }

.page-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-6);
  flex-wrap: wrap;
}
.page-header-left { flex: 1; min-width: 0; }
.page-header-right { flex-shrink: 0; display: flex; gap: var(--s-2); align-items: center; }

.page-eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--s-2);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-display-md);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
}
.page-title.lg { font-size: var(--fs-display-lg); font-weight: 400; }
.page-title.xl { font-size: var(--fs-display-xl); font-weight: 400; }
.page-title em { font-style: italic; color: var(--gold); font-weight: 400; }

.page-description {
  font-size: var(--fs-body);
  color: var(--fg-2);
  margin-top: var(--s-2);
  max-width: 56ch;
  line-height: var(--lh-base);
}

.page-status {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-meta);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--fg-2);
}

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn .icon,
.btn-ghost-dark .icon,
.btn-tertiary .icon,
.btn-ghost .icon,
.btn-primary .icon { width: 14px; height: 14px; }

.btn.primary {
  background: var(--accent);
  color: var(--fg-on-gold);
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.secondary {
  background: var(--bg-surface);
  color: var(--fg-1);
  border-color: var(--border-strong);
}
.btn.secondary:hover { background: var(--bg-surface-2); border-color: var(--fg-2); }

.btn.ghost {
  background: transparent;
  color: var(--fg-2);
  border-color: transparent;
}
.btn.ghost:hover { background: var(--bg-surface-2); color: var(--fg-1); }

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.btn.sm { padding: 6px 12px; font-size: 10.5px; }
.btn.lg { padding: 12px 22px; font-size: 13px; }
.btn.icon-only { padding: 8px; aspect-ratio: 1; }

/* Icon link — used as table row action; icon-first, text on hover */
.icon-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--fg-2);
  cursor: pointer;
  /* Perf pass D: narrowed `all` to the props that actually change. */
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-link:hover { background: var(--bg-surface-2); color: var(--fg-1); }
.icon-link .icon { width: 14px; height: 14px; }
.icon-link.danger { color: var(--danger); }
.icon-link.danger:hover { background: var(--danger-bg); }

/* =========================================================================
   CHIPS & STATUS PILLS
   ========================================================================= */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.chip.info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-border); }
.chip.success { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.chip.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.chip.danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-border); }
.chip.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-border); }
.chip.gold    { color: var(--gold-hover); background: var(--gold-faint); border-color: var(--gold-soft); }

/* Filter chips (toggleable) */
.filter-row {
  display: flex; gap: var(--s-2); flex-wrap: wrap;
  margin-bottom: var(--s-5);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--fg-1); }
.filter-chip.is-active {
  background: var(--fg-1);
  color: var(--bg-content);
  border-color: var(--fg-1);
}
.filter-chip-count {
  background: var(--bg-surface-2);
  color: var(--fg-2);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
}
.filter-chip.is-active .filter-chip-count {
  background: rgba(255,255,255,0.18);
  color: var(--fg-on-dark);
}

/* =========================================================================
   TABS — folder-style, literal tabs sitting on a content surface
   ========================================================================= */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 var(--s-2);
  margin-bottom: 0;
  position: relative;
  z-index: 2;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 10px 18px 9px;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--bg-surface-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--fg-3);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  white-space: nowrap;
  position: relative;
  border-radius: var(--r-md) var(--r-md) 0 0;
  margin-bottom: -1px; /* overlap content border */
}
.tab:hover { color: var(--fg-1); background: var(--bg-surface); }

.tab.is-active {
  color: var(--fg-1);
  font-weight: 600;
  background: var(--bg-surface);
  border-color: var(--border);
  z-index: 3;
}
/* Gold/accent strip on top of active tab */
.tab.is-active::before {
  content: "";
  position: absolute;
  left: -1px; right: -1px; top: -1px;
  height: 3px;
  background: var(--accent);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
/* Mask out the content border under the active tab so they appear connected */
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--bg-surface);
}

.tab .tab-count {
  background: var(--bg-surface);
  color: var(--fg-3);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-body);
  border: 1px solid var(--border);
}
.tab.is-active .tab-count {
  background: var(--accent-faint);
  color: var(--accent);
  border-color: transparent;
}

/* Tab panel — the content surface tabs sit on */
.tab-panel:not(.is-active) { display: none; }
.tab-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0 var(--r-md) var(--r-md) var(--r-md);
  padding: var(--s-6);
  position: relative;
  z-index: 1;
  margin-bottom: var(--s-6);
}

/* =========================================================================
   CARDS
   ========================================================================= */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-5);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.card.interactive { cursor: pointer; }
.card.interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }

.stat-card { padding: var(--s-4) var(--s-5); }
.stat-label {
  font-family: var(--font-body);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: var(--s-2);
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 36px;
  line-height: 1;
  color: var(--fg-1);
}
.stat-meta {
  font-size: var(--fs-meta);
  color: var(--fg-3);
  margin-top: var(--s-2);
}

/* =========================================================================
   INPUTS
   ========================================================================= */

.field {
  display: flex; flex-direction: column;
  gap: 5px;
}
.field-label {
  font-family: var(--font-body);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-3);
}
.input,
.select,
.textarea {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  background: var(--bg-surface);
  color: var(--fg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: var(--focus-ring);
}
.input::placeholder { color: var(--fg-4); }

/* =========================================================================
   TABLES
   ========================================================================= */

.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--fg-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-body-sm);
  color: var(--fg-1);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-surface-2); }

.table .row-primary {
  font-weight: 500;
  color: var(--fg-1);
}
.table .row-secondary {
  font-size: var(--fs-meta);
  color: var(--fg-3);
  margin-top: 1px;
}
.table .row-actions {
  display: flex; gap: var(--s-1);
  justify-content: flex-end;
  opacity: 0.55;
  transition: opacity var(--dur-fast);
}
.table tr:hover .row-actions { opacity: 1; }

/* =========================================================================
   TOOLBAR — replaces the 3-row utility ribbons
   ========================================================================= */

.toolbar {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.toolbar-search {
  flex: 1;
  min-width: 240px;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-2);
}
.toolbar-search .icon { width: 16px; height: 16px; color: var(--fg-3); flex-shrink: 0; }
.toolbar-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: var(--fs-body);
  outline: none;
}
.toolbar-search input::placeholder { color: var(--fg-4); }
.toolbar-divider {
  width: 1px; height: 20px; background: var(--border);
}
.toolbar-select {
  border: none;
  background: transparent;
  padding: 8px var(--s-3);
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
}
.toolbar-select:hover { color: var(--fg-1); }

/* =========================================================================
   SECTION HEADERS within a page
   ========================================================================= */

.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: var(--s-8) 0 var(--s-4);
  gap: var(--s-4);
}
.section-header:first-child { margin-top: 0; }
.section-header-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-display-sm);
  color: var(--fg-1);
}
.section-header-desc {
  font-size: var(--fs-body-sm);
  color: var(--fg-3);
  margin-top: 2px;
}
.section-eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--s-1);
}

/* =========================================================================
   PLATFORM ICONS — small inline platform identification
   ========================================================================= */

.platform-icon {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--fg-1);
}
.platform-icon svg { width: 16px; height: 16px; flex-shrink: 0; }
.platform-icon.linkedin svg { color: #0a66c2; }
.platform-icon.facebook svg { color: #1877f2; }
.platform-icon.instagram svg { color: #e4405f; }
.platform-icon.tiktok svg { color: #000000; }

/* =========================================================================
   GRID HELPERS
   ========================================================================= */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }

.stack-1 > * + * { margin-top: var(--s-1); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-6 > * + * { margin-top: var(--s-6); }

.row { display: flex; align-items: center; gap: var(--s-3); }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

/* =========================================================================
   AVATAR / LOGO TILES
   ========================================================================= */

.tile {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--bg-surface-2);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-2);
  flex-shrink: 0;
  overflow: hidden;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile.lg { width: 48px; height: 48px; font-size: 18px; }

/* =========================================================================
   FOOTER — minimal
   ========================================================================= */

.app-footer {
  margin-top: var(--s-16);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-meta);
  color: var(--fg-3);
  gap: var(--s-4);
  flex-wrap: wrap;
}
.app-footer-links { display: flex; gap: var(--s-4); }
.app-footer a { color: var(--fg-3); }
.app-footer a:hover { color: var(--fg-1); }

/* Connections page → Avatar preview chip inside each display-profile
   tab panel. (The old <details> accordion has been replaced by tabs;
   only the preview chip styles remain in use.) */
.display-profile-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  padding: 8px 12px;
  background: var(--mx2-stone-700);
  border-radius: 6px;
}
.display-profile-preview img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
/* Higher-specificity match needed: .mx2-section--paper .micro.dim in
   mx2.css (0,3,0) sets a dark color appropriate for paper backgrounds,
   but the preview chip itself has a dark stone-700 background, so we
   need to override back to on-dark text. */
.mx2-section--paper .display-profile-preview .dim.micro { color: var(--fg-on-dark); }

/* ── Search input — universal magnifying-glass prefix ───────────────────
   Drew, 2026-05-21: every search box should match the command-palette
   pattern (magnifying glass icon on the left). Rather than rewrap every
   <input> with a flex container + SVG, we paint the icon as a
   background-image and reserve left padding for it. Auto-applies to
   <input type="search">, the .search-input utility class, and every
   pre-existing search-flavored class so feature pages get the icon for
   free without markup churn.

   Wrapped-icon patterns (.toolbar-search, .glass-command .search,
   .discussion-search wrapper variants) keep their own SVG markup and
   sit out this rule. */
input[type="search"],
input.search-input,
.search-input,
.discussion-search__input,
.list-filter__search,
.composer-library-modal-search {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 36px !important;
}

/* Search inputs on dark surfaces (composer asset modal) — swap the
   stroke color so the glyph stays legible. Most search inputs on the
   mx2 side live inside cream content cards, so they keep the default
   dark-on-light icon; only the composer asset picker modal needs the
   light variant. Add other selectors here as new dark-surface inputs
   show up. */
.composer-library-modal-search {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23bbb' stroke-width='1.8' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
}

/* Opt-out: wrappers that already render their own magnifying-glass
   SVG before the input (.toolbar-search, .glass-command .search,
   .glass-input). The wrapper's SVG provides the visible icon — the
   input should not double up via its background. */
.toolbar-search input[type="search"],
.toolbar-search input.search-input,
.glass-command .search input[type="search"],
.glass-command .search input.search-input,
.glass-input input[type="search"],
.glass-input input.search-input,
.glass-input input {
  background-image: none;
  padding-left: 0 !important;
}
