:root {
  /* Surface stack */
  --bg: #1B232C;
  --surface: #2E3944;
  --surface-2: #36414D;          /* slightly lifted for nested cards */
  --surface-down: #28313B;       /* slightly recessed for nested panels */
  --border-1: #2A3540;
  --border-2: #344150;
  --border-3: #3E4D5A;
  --border-4: #4A5A68;

  /* Text scale */
  --text: #D3D9D4;
  --text-soft: #BDC3BE;
  --text-muted: #94A2A4;
  --text-dim: #748D92;

  /* Accent (teal action color + tonal companions) */
  --accent: #3c5a79;             /* slate accent for buttons/links on dark */
  --accent-hover: #7691b0;
  --accent-deep: #124E66;        /* deep teal for press / gradient stops */
  --accent-soft: #1A4858;        /* subtle backgrounds / borders */
  --accent-on: #D3D9D4;          /* text color on top of slate buttons */

  /* Secondary slate accent (used for muted bubbles, dividers, secondary buttons) */
  --slate: #748D92;
  --slate-soft: #5F7A7F;

  /* Semantic */
  --danger: #C67566;
  --success: #7AA37C;
  --highlight-yellow: #f5c518;

  /* Type */
  /* Project standardized on Roboto everywhere — including controls that
     previously used Roboto Mono (search box, install CTA, version labels,
     pagination, etc). --mono is kept as an alias for compatibility with
     existing `font: Npx var(--mono)` declarations; it now points at the
     same sans stack as --sans. */
  --mono: "Roboto", -apple-system, "Helvetica Neue", sans-serif;
  --sans: "Roboto", -apple-system, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; line-height: 1.45; overflow-x: hidden; }
/* Sticky-footer pattern: body is a flex column with min-height: 100vh so
   .app-main grows to fill whatever's left of the viewport after the
   header+footer. .app-main stays a normal block element so child layouts
   (the .skill-detail-grid and .edit-grid two-column grids) work without
   competing with a parent flex axis. .browse-layout's grid is wired
   separately so filter-side reaches the footer via min-height. */
body { display: flex; flex-direction: column; min-height: 100vh; }
.app-main { flex: 1 1 auto; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }

/* Header */
.app-header {
  display: flex; align-items: center;
  gap: 14px; padding: 22px 28px;
  border-bottom: 1px solid var(--border-2);
}
.app-logo img { width: 148px; height: auto; display: block; }
.app-nav { display: flex; gap: 4px; font-size: 13px; color: var(--text-muted); margin-left: 10px; margin-right: auto; align-items: center; }
/* Within-group nav items sit tight (4px flex gap); the gap span widens the
   visual separation between groups so paired links read as a unit. */
.app-nav .app-nav-gap { display: inline-block; width: 18px; }
.app-nav a { padding: 0 6px; }
.app-nav a {
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav a:hover { color: var(--accent-hover); }
.app-nav a[aria-current="page"] {
  background: var(--surface);
  color: #a2cefa;
}
.app-search-wrap { display: flex; align-items: center; gap: 8px; }

/* Sort controls — sit to the left of the search box on the browse page */
.sort-controls {
  display: flex; align-items: center; gap: 3px;
  font: 11px var(--mono);
}
.sort-label {
  color: var(--text-dim);
  font: 600 11px/1 var(--sans);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-right: 6px;
}
.sort-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1;  /* normalize height so inactive (text only) and active
                      (text + 16px arrow) buttons render identically */
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sort-btn:hover { color: var(--text); background: var(--surface); }
.sort-btn.active {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.sort-btn .sort-arrow { font-size: 16px; line-height: 1; opacity: 0.85; }
.app-search {
  background: var(--surface); border: 1px solid var(--border-3);
  border-radius: 6px; padding: 5px 12px; font: 12px var(--mono);
  width: 130px; color: var(--text-dim);
}
/* Install CTA — same shape as the search box. Filled with --accent (the
   same slate that an active sort button uses) so the row reads as one
   palette. Plain weight, all-caps, light letter-spacing. */
.install-cta-btn {
  background: var(--accent); border: 1px solid var(--accent);
  border-radius: 6px; padding: 5px 12px; font: 11px var(--mono);
  color: var(--accent-on); text-decoration: none;
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: all 0.15s ease;
  display: inline-flex; align-items: center;
}
.install-cta-btn:hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
  color: var(--accent-on);
}
.install-cta-btn.is-current {
  background: var(--accent-deep); border-color: var(--accent-deep);
  color: var(--accent-on);
}
.user-pill { margin: 0; }
.user-pill button {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border-4);
  color: var(--accent); font: 11px/1 var(--mono); font-weight: 600;
}

.app-main { padding: 0; }

/* Account / API tokens page */
.account-shell { max-width: 880px; margin: 32px auto; padding: 0 28px; }
.token-flash {
  background: var(--surface);
  border: 1px solid #be5a1c;
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 24px;
}
.token-flash p { margin: 0; font-size: 13px; color: var(--text); }
.token-value {
  background: var(--bg);
  border: 1px solid var(--border-3);
  border-radius: 4px;
  padding: 10px 14px;
  margin-top: 10px;
  font: 12px var(--mono);
  color: #be5a1c;
  word-break: break-all;
}
.token-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.token-form label { margin-right: 6px; }
.token-form input[type="text"] {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border-3);
  border-radius: 4px;
  padding: 7px 10px;
  font: 13px var(--mono);
  color: var(--text);
}
.token-form button {
  background: var(--accent);
  color: var(--accent-on);
  border: none;
  border-radius: 4px;
  padding: 8px 14px;
  font: 12px var(--sans);
  font-weight: 600;
  cursor: pointer;
}
.token-form button:hover { background: var(--accent-hover); }
.token-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}
.token-table th, .token-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-1);
}
.token-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}
.token-table .link-btn {
  background: transparent;
  border: none;
  color: #be5a1c;
  font: 11px var(--mono);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0;
}
.token-table .link-btn:hover { color: #d97524; }
.token-table .ok { color: #6e9ecf; }

.app-footer {
  /* No top margin so the filter-side's vertical border butts directly up
     against the footer's top border. No max-width so the border spans the
     full viewport edge-to-edge like the per-page rule above it. */
  margin: 0;
  padding: 25px 30px;
  border-top: 1px solid var(--border-2);
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.app-footer p { margin: 0; font-weight: 400; }
.app-version { margin-left: 8px; font: 10px var(--mono); color: var(--text-muted); opacity: 0.7; }

/* Tools / Knowledge Bases */
.kb-shell { max-width: 1180px; margin: 12px auto 32px; padding: 0 28px; }
.kb-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.kb-head h1 { font: 600 22px/1.2 var(--sans); margin: 0; }
.kb-cards { list-style: none; padding: 0; margin: 4px 0 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kb-card { background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 8px; padding: 16px 18px; }
.kb-card h3 { margin: 0 0 6px; font: 600 16px/1.3 var(--sans); }
.kb-card h3 a { color: var(--text); text-decoration: none; }
.kb-card h3 a:hover { color: var(--accent-hover); }
.kb-card .kb-card-meta { color: var(--text-dim); font: 11px var(--mono); margin-top: 8px; }
.kb-article-list { list-style: none; padding: 0; margin: 18px 0 0; }
.kb-article-item { padding: 14px 0; border-bottom: 1px solid var(--border-1); }
.kb-article-item:last-child { border-bottom: none; }
.kb-article-item h3 { margin: 0 0 4px; font: 600 16px/1.3 var(--sans); }
.kb-article-item h3 a { color: var(--text); text-decoration: none; }
.kb-article-item h3 a:hover { color: var(--accent-hover); }
.tools-section { margin: 0 0 32px; }
.tools-section-head { display: flex; align-items: baseline;
  justify-content: space-between; margin-bottom: 10px; }
.tools-section-head h2 { font: 600 18px/1.2 var(--sans); margin: 0; }
.filter-pill.pill-active { background: var(--surface-2); color: var(--text); }

/* Tag picker — click-to-toggle pills used on edit forms in place of a
   <select multiple>, which has the well-known UX trap of requiring Ctrl+
   click to deselect. Each pill is a checkbox label; checked pills get the
   accent fill so the current selection is obvious at a glance. */
.tag-pick {
  display: flex; flex-wrap: wrap;
  column-gap: 4px; row-gap: 5px;
  margin-top: 4px;
}

/* Stacked multi-select box — a bordered card where every option is a full-
   width row. Clicking a row toggles its checkbox; selected rows fill with
   accent. No scrollbar (overflow: visible) so the entire list is always
   visible. Compact vertical rhythm. Used for Applications + Intents
   pickers across upload/edit forms. */
.select-box {
  display: flex; flex-direction: column;
  border: 1px solid var(--border-3);
  border-radius: 5px;
  background: var(--surface);
  /* Clip the row backgrounds to the rounded corners — without this, the
     dark row fill extends to the box's sharp inner corners and the
     border-radius isn't visible at the top/bottom. */
  overflow: hidden;
  margin-top: 4px;
}
.select-box__row {
  display: flex; align-items: center;
  padding: 4px 10px;
  font: 11px var(--sans);
  color: var(--text-soft);
  /* Unselected rows pick up the form-field dark color so each row reads
     as a recessed clickable surface inside the .select-box card. */
  background: #161D25;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-1);
  transition: background 0.1s ease, color 0.1s ease;
}
.select-box__row:last-child { border-bottom: none; }
.select-box__row:hover { background: var(--surface-2); color: var(--text); }
.select-box__row input { display: none; }
.select-box__row:has(input:checked) {
  /* Selected row pops by flipping to the container surface color (the
     lighter shade unselected rows used to sit on). */
  background: var(--surface);
  color: var(--text);
}
.tag-pick-pill {
  display: inline-flex; align-items: center;
  font: 11px var(--sans);
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border-3);
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tag-pick-pill:hover { background: var(--surface-2); color: var(--text); }
.tag-pick-pill input { display: none; }
.tag-pick-pill:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.tag-pick-pill .picker-scope {
  opacity: 0.65;
  font-size: 0.78em;
  margin-right: 2px;
}
.tag-pick-pill:has(input:checked) .picker-scope { opacity: 0.85; }

.ref-group { margin-bottom: 10px; }
.ref-group:last-child { margin-bottom: 0; }
.ref-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.ref-list { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.ref-list li { padding: 2px 0; }
.ref-list a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.ref-list a:hover { border-bottom-color: var(--accent); }
.ref-meta { color: var(--muted); font-size: 0.78rem; }

/* Frontmatter strip — sits above the rendered markdown body when a plugin
   bundle file (agent / command / SKILL.md) starts with a YAML block.
   Renders as a tight definition list so name / description / tools read
   as labeled fields instead of running together as a paragraph. */
.md-frontmatter {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0 0 18px;
  padding: 10px 14px;
  background: #161D25;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font: 12px var(--mono);
}
.md-frontmatter dt { color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; font-size: 10px; align-self: center; }
.md-frontmatter dd { color: var(--text); margin: 0; line-height: 1.5; }
.md-frontmatter dd code {
  background: transparent; padding: 0; color: var(--accent-hover);
}

/* Admin tag-scope grid — checkbox columns on /admin/applications + /admin/intents.
   Each checkbox lives in its own <td> so it lines up vertically under the
   column header. The companion <form id="scopes-..."> sits above the table
   and inputs reference it via form="..." so the row still submits as one. */
.scope-table th.scope-col {
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  width: 72px;
}
.scope-table td.scope-cell {
  text-align: center;
  width: 72px;
}
.scope-table td.scope-cell input {
  transform: scale(1.1);
  cursor: pointer;
  vertical-align: middle;
}
/* Auto-save success flash — applied to the row by the JS handler. */
.scope-table tr.scope-saved {
  background: rgba(122, 163, 124, 0.12);
  transition: background 0.6s ease;
}

/* Browse */
.browse-layout {
  display: grid; grid-template-columns: 200px 1fr;
}
.filter-side { border-right: 1px solid var(--border-2); padding: 24px 20px; }
.filter-side h4 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 20px 0 10px; font-weight: 600;
}
.filter-side h4:first-child { margin-top: 0; }
.filter-side .filter-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 20px 0 10px;
}
.filter-side .filter-head:first-child { margin-top: 0; }
.filter-side .filter-head h4 { margin: 0; }
.filter-side .filter-reset {
  background: transparent; border: none; padding: 0;
  font: 10px var(--mono);
  font-weight: 600;
  color: #be5a1c;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease;
}
.filter-side .filter-reset:hover { color: #d97524; }
.filter-side label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-soft); cursor: pointer; padding: 2px 0;
}
/* Pill-style filter buttons (replaces native checkbox visuals) */
.filter-side .filter-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 1px 10px; margin: 0;
  line-height: 1.25;
  font-size: 12px; color: var(--text-soft);
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.filter-side .filter-pill:hover { background: var(--surface); color: var(--text); }
.filter-side .filter-pill:has(input:checked) {
  background: var(--surface-2);
  border-color: var(--border-4);
  color: var(--text);
}
.filter-side .filter-pill input[type="checkbox"] {
  /* Hide the native control but keep it focusable + form-submittable */
  position: absolute; opacity: 0; pointer-events: none;
  width: 0; height: 0; margin: 0;
}
.filter-side .filter-pill .pill-name { flex: 1; }
.filter-side .filter-pill .count {
  color: var(--text-dim); font: 11px var(--mono);
}
.filter-side input[type=checkbox] { accent-color: var(--accent); }
.filter-side .count { margin-left: auto; color: var(--text-dim); font: 11px var(--mono); }

.browse-main { padding: 4px 30px; min-width: 0; }

.skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  padding: 20px 0; gap: 22px;
  border-bottom: 1px solid var(--border-1);
}
/* Drop the bottom border of whichever skill-row sits immediately above the
   per-page-wrap, so the bottom of the list doesn't show a doubled rule
   (row's own border + per-page-wrap's top border). #results' actual
   :last-child is the per-page-wrap, not the last skill-row, so the
   :has(+ .per-page-wrap) selector is the right one here. */
.skill-row:has(+ .per-page-wrap) { border-bottom: none; }
/* Team capsule sits to the LEFT of the app/intent tags on browse rows,
   matching the 25px effective gap used on the detail page (5px from the
   .row-tags flex gap + 20px from the team capsule's margin-right). */
.row-tags .bubble-team { margin-right: 20px; }
.row-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 6px;
}
/* .copy-icon inherits .down-icon now — kept as a marker class for JS hooks. */
.skill-row h3 { font-size: 14px; margin: 0 0 4px; font-weight: 600; }
.skill-row p { color: var(--text-muted); font-size: 12px; margin: 0; line-height: 1.45; }
.skill-row .team { color: var(--text-dim); font: 11px var(--mono); }
.skill-row .ver {
  color: #e6ecf3; font: 11px var(--mono);
  display: inline-flex; align-items: center;
  height: 28px;  /* matches the action-icon row height for vertical alignment */
}
.skill-row .down { text-align: right; color: var(--text-muted); font-size: 16px; }
.skill-row .down:hover { color: var(--accent); }

.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.tag {
  border: 1px solid var(--border-4); border-radius: 3px;
  padding: 1px 7px; font: 10px/1.4 var(--mono);
  color: var(--text-soft); letter-spacing: 0.02em;
}
.tag.app { color: var(--accent); border-color: var(--accent-soft); }
.tag.intent { color: var(--accent-blue); border-color: var(--accent-blue-soft); }

/* Login */
.login-card {
  max-width: 380px; margin: 80px auto; padding: 40px 32px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px;
  text-align: center;
}
.login-logo { width: 185px; height: auto; margin-bottom: 28px; }
.login-card h1 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.muted { color: var(--text-muted); margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  background: var(--bg); border: 1px solid var(--border-3); border-radius: 6px;
  padding: 10px 12px; color: var(--text); font: 13px var(--sans);
}
.login-form button {
  background: var(--accent); color: var(--accent-on); border: none; border-radius: 6px;
  padding: 10px 16px; font-weight: 600;
}
.error { color: var(--danger); margin-bottom: 16px; }
.success { color: var(--success); margin: 16px 0; }

/* Detail page — two-column layout */
.skill-detail { max-width: 1180px; margin: 32px auto; padding: 0 28px; }
/* Flex row instead of grid — grid was wrapping the rail below main even
   with explicit grid-column placement, suspected wider-than-235px rail
   content forcing the rail to a new track row. Flex is more forgiving:
   the rail is locked to 235px (flex: 0 0 235px) and refuses to grow or
   shrink; the main takes the remaining space (flex: 1 1 0) and can shrink
   below its content via min-width: 0. order: -1 on the rail puts it on
   the LEFT visually (in flex, `order` actually relocates items, unlike
   in grid). */
.skill-detail-grid {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}
@media (max-width: 900px) { .skill-detail-grid { flex-direction: column; } }
.skill-detail-grid > .skill-detail-rail {
  flex: 0 0 235px;
  order: -1;
  max-width: 235px;
}
.skill-detail-grid > .skill-detail-main {
  flex: 1 1 0;
  min-width: 0;
}
.skill-detail-rail {
  min-width: 0;
  display: flex; flex-direction: column;
  gap: 24px;
  /* Rail scrolls with the page (no sticky, no internal scrollbar). Long
     bundle trees just extend the page height; the user scrolls the whole
     window normally. */
}
.skill-detail-head h1 {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 3px;
}
.skill-detail-head .tags .bubble-team { margin-right: 10px; }
.skill-detail-head .lede {
  color: var(--text-muted); font-size: 15px; line-height: 1.55;
  margin-bottom: 14px; max-width: 64ch;
}
.skill-detail-head .tags { margin-bottom: 28px; }

/* Action row: Download | Copy | Edit — three matched-weight outlined
   buttons with a subtle accent on the primary. The previous treatment
   had a heavy blue box-shadow on Download that read as bolt-on. */
.action-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  justify-content: space-between;
}
.action-group { display: flex; gap: 6px; align-items: center; }
.action-group-left { margin-right: auto; }
.action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 6px;
  white-space: nowrap;
  font: 11px/1.2 var(--sans); font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none;
}
.action-btn.primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.action-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.action-btn.primary:disabled,
.action-btn.primary[disabled] {
  background: var(--surface-2);
  border-color: var(--border-3);
  color: var(--text-dim);
  cursor: default;
  /* Block all pointer interaction — no hand, no hover, no click. The
     button is intentionally inert until the form is dirty. */
  pointer-events: none;
}
.action-btn.secondary {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-3);
}
.action-btn.secondary:hover {
  background: var(--surface);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}
.action-btn.secondary:hover { border-color: var(--accent-hover); color: var(--accent-hover); }
.action-btn.danger {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #dc2626;
}
.action-btn.danger:hover {
  background: #b91c1c;
  color: #ffffff;
  border-color: #b91c1c;
}
.action-btn svg { flex-shrink: 0; }
.action-btn.icon-only { padding: 5px; gap: 0; }
/* Match the row-action style (dark transparent + light-blue hover) so the
   detail-page action row reads consistently with browse rows. */
.action-btn.primary.icon-only {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-3);
}
.action-btn.primary.icon-only:hover {
  background: var(--surface-2);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}
/* Install dropdown trigger on detail pages: hide the disclosure marker and
   match the height of the surrounding square icon buttons so the row reads
   as a single tidy strip even though this one is wider (3 logos). */
.action-btn.icon-only.mcp-icon {
  list-style: none;
  padding: 0 8px;
  height: 26px;
  box-sizing: border-box;
}
.action-btn.icon-only.mcp-icon::-webkit-details-marker { display: none; }
.action-btn.icon-only.mcp-icon::marker { content: none; }
.row-mcp[open] > .action-btn.icon-only.mcp-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.action-btn.cancel {
  background: #2E3944;
  color: #ffffff;
  border-color: #2E3944;
}
.action-btn.cancel:hover {
  background: #3a4754;
  border-color: #3a4754;
  color: #ffffff;
}

.skill-detail-rail > .rail-section:first-child { margin-bottom: -8px; }

/* Edit page — danger zone */
/* Chip-input for free tags — Enter creates a chip, × removes it,
   Backspace in an empty entry removes the trailing chip. */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-3);
  border-radius: 6px;
  padding: 6px 8px;
  min-height: 36px;
  align-items: center;
  cursor: text;
}
.chip-input:focus-within { border-color: var(--accent-hover); }
.chip-input .chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border-3);
  border-radius: 4px;
  padding: 2px 4px 2px 8px;
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.02em;
}
.chip-input .chip-x {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 13px; line-height: 1;
  padding: 0 4px; margin-left: 2px;
  border-radius: 3px;
}
.chip-input .chip-x:hover { color: var(--danger); }
.chip-input .chip-entry {
  flex: 1; min-width: 80px;
  border: none; background: transparent;
  color: var(--text); font: 13px var(--sans);
  outline: none; padding: 4px 2px;
}

.admin-only {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-2);
}
.admin-only h4 {
  color: var(--text-dim);
  font: 600 10px/1 var(--sans);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin: 0 0 8px;
}
.admin-only .hint { color: var(--text-muted); font-size: 12px; margin: 0 0 12px; line-height: 1.5; }

/* Edit page multi-selects — no vertical scroll bar (size attribute sets
   exactly the right height; this suppresses any always-on track). */
.edit-side select[multiple] { overflow-y: hidden; padding: 6px 4px; }
.edit-side select[multiple] option { padding: 6px 10px; line-height: 1.4; border-radius: 4px; }
.edit-side select[multiple] option:checked { background: #34495E; color: var(--text); }
.upload-card select[multiple] { padding: 6px 4px; }
.upload-card select[multiple] option { padding: 6px 10px; line-height: 1.4; border-radius: 4px; }
.upload-card select[multiple] option:checked { background: #34495E; color: var(--text); }
/* Same treatment on the Create-Skill page: show all options, no scrollbar. */
.upload-card select[multiple] { overflow-y: hidden; }

/* File tree — bare typography, no boxed card. The rail-section frame
   above already establishes the section; a nested box on top made the
   rail look bolted-together. */
.skill-detail-rail .file-tree {
  background: transparent;
  border: none;
  padding: 0;
}
.skill-detail-rail .file-tree pre {
  margin: 0; font: 12px/1.2 var(--mono);
  color: var(--text-soft); white-space: pre;
}
/* Interactive tree with CSS-drawn connectors. Each row is a flex line of
   depth-indicator cells + the filename/dir label. The cells render the
   vertical bars + corner connectors as CSS borders/pseudo-elements
   instead of as text characters, so the bars stay continuous through
   any line-height. */
.file-tree--css {
  display: flex; flex-direction: column;
  font: 12px/1 var(--mono);
  color: var(--text-soft);
}
.tree-row {
  display: flex; align-items: stretch;
  min-height: 22px;             /* vertical breathing room */
  white-space: nowrap;
  overflow: hidden;             /* clip long names at the rail edge */
}
.tree-cell {
  position: relative;
  flex: 0 0 auto;
  width: 18px;                  /* one depth level */
}
/* Continuation: parent's vertical bar extends full row height through
   this cell. Used when a sibling list is still ongoing at this depth. */
.tree-cell--vert::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  border-left: 1px solid var(--border-3);
}
/* Branch (├): full-height vertical bar + horizontal stub from the
   midline pointing right toward the label. */
.tree-cell--branch::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  border-left: 1px solid var(--border-3);
}
.tree-cell--branch::after {
  content: '';
  position: absolute;
  left: 7px; top: 50%;
  width: 10px;
  border-top: 1px solid var(--border-3);
}
/* Corner (└): vertical bar from top down to midline only + horizontal
   stub. Signals "last sibling at this depth". */
.tree-cell--corner::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; height: 50%;
  border-left: 1px solid var(--border-3);
}
.tree-cell--corner::after {
  content: '';
  position: absolute;
  left: 7px; top: 50%;
  width: 10px;
  border-top: 1px solid var(--border-3);
}
/* Empty spacer — no parent line at this depth. */
.tree-cell--space {}

.tree-name {
  flex: 1 1 auto; min-width: 0;   /* allow shrink so ellipsis can kick in */
  padding: 0 6px;
  line-height: 22px;              /* center text now that it's not a flexbox */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-name--dir { color: var(--text); font-weight: 500; }

.file-tree__link {
  display: block;
  flex: 1 1 auto; min-width: 0;   /* truncate long linked filenames too */
  color: #6e9ecf;
  text-decoration: none;
  padding: 0 6px;
  line-height: 22px;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
  cursor: pointer;
}
.file-tree__link:hover { background: var(--surface-2); color: var(--accent-hover); }
.file-tree__link.is-selected {
  background: var(--accent);
  color: var(--accent-on);
}

/* Single-file pane in many-files mode — heading strip + View/Edit tabs. */
.file-view__head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 0 0 18px;     /* 18px between the FILE header and the rule */
  margin-bottom: 18px;   /* 18px between the rule and the View/Edit tabs */
  border-bottom: 1px solid var(--border-2);
}
.file-view__label {
  font: 600 10px/1 var(--sans);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim);
}
.file-view__path { font: 12px var(--mono); color: var(--text); }
/* display: block (not flex) so the textarea is sized purely by its own
   width: 100% / box-sizing: border-box and not by any flex-item basis. */
.file-view__edit-form { display: block; width: 100%; }
.file-view__edit-form > .md-textarea { margin-bottom: 10px; }
.file-view__edit-actions {
  display: flex; align-items: center; gap: 14px;
}
.file-view__edit-hint { margin: 0; font-size: 11px; }
/* Equal-width View/Edit tabs so the two buttons read as a matched pair.
   Explicit width + flex: 0 0 — `min-width` alone wasn't enough because
   the base .tab padding can exceed 60px on its own. */
/* Higher specificity than .tabs.tabs-dense .tab (which uses a `font:`
   shorthand that would otherwise reset our font-size when it appears
   later in source order). */
.tabs.tabs-dense.file-view__tabs .tab { width: 80px; flex: 0 0 80px; text-align: center; font: 14px var(--sans); }

/* Plugin-edit: only the currently-selected file's textarea is visible.
   The others stay in the DOM so the form posts every file:* field on
   Save. When any textarea is dirty, .form-dirty fires on the form and
   the Save button gets a 2px white outline as a visual nudge. */
.plugin-edit-panel { display: none; }
.plugin-edit-panel.is-active { display: block; }
.form-dirty #plugin-save-btn,
.edit-shell:has(.form-dirty) #plugin-save-btn {
  outline: 2px solid #ffffff;
  outline-offset: 1px;
}

/* Edit textarea inside the file-view — darker than page bg to match the
   frontmatter card style (NAME / DESCRIPTION / TOOLS strip on View tab). */
.file-view__edit-form .md-textarea {
  background: #161D25;
}

/* Force the file-view component to fill its column. Without this, the
   <textarea> default cols=20 combined with the form's flex layout can
   leave the textarea narrower than the surrounding View content. The
   chain is: .skill-detail-main → #file-view-container → .file-view →
   .tab-panel → .file-view__edit-form → textarea. We pin width: 100%
   + min-width: 0 at every level so the textarea can't shrink-fit to
   its cols attribute. */
#file-view-container,
.file-view,
.file-view .tab-panel { width: 100%; min-width: 0; }
.file-view__edit-form { width: 100%; min-width: 0; }
.file-view__edit-form > * { min-width: 0; max-width: 100%; }
.file-view__edit-form .md-textarea {
  display: block;
  width: 100%;
  min-width: 0;
  background: #161D25;
}

/* Body sections — primary visual weight.
   "Refined Roboto" — 16/1.75 body, weight 400, all headings + bold in #84a6e1.
   Italic stays muted; code keeps its existing inline treatment. */
.skill-md { color: var(--text); font-size: 16px; line-height: 1.75; }
.skill-human { font-size: 16px; line-height: 1.75; color: var(--text); }
.skill-human p { margin-bottom: 14px; }
.skill-human strong { color: #84a6e1; font-weight: 600; }
.skill-human em { color: var(--text-muted); font-style: italic; }
.skill-human h1 { font-size: 28px; margin: 24px 0 10px; font-weight: 400; line-height: 1.2; color: #84a6e1; letter-spacing: -0.02em; }
.skill-human h2 { font-size: 23px; margin: 28px 0 8px; font-weight: 400; line-height: 1.25; color: #84a6e1; }
.skill-human h3 { font-size: 17px; margin: 22px 0 6px; font-weight: 600; line-height: 1.3; color: #84a6e1; }
.skill-human > :first-child { margin-top: 0; }
.skill-human hr { border: none; border-top: 1px solid var(--border-1); margin: 20px 0; opacity: 0.7; }
.skill-human pre {
  background: var(--surface); padding: 16px; border-radius: 8px;
  border: 1px solid var(--border-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.skill-human p + pre { margin-top: 1em; }

.skill-divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--accent); font: 16px/1 var(--mono);
  text-transform: uppercase; letter-spacing: 0.18em;
  margin: 36px 0 28px;
}
.skill-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border-3), transparent);
}

.skill-llm { color: var(--text); font-size: 16px; line-height: 1.75; }
.skill-llm h1 { margin: 24px 0 10px; font-size: 28px; font-weight: 400; color: #84a6e1; letter-spacing: -0.02em; line-height: 1.2; }
.skill-llm h2 { margin: 28px 0 8px; font-size: 23px; font-weight: 400; color: #84a6e1; line-height: 1.25; }
.skill-llm h3 { margin: 22px 0 6px; font-size: 17px; font-weight: 600; color: #84a6e1; line-height: 1.3; }
.skill-llm > :first-child { margin-top: 0; }
.skill-llm hr { border: none; border-top: 1px solid var(--border-1); margin: 20px 0; opacity: 0.7; }
.skill-llm p { margin-bottom: 0.9em; }
.skill-llm p + pre { margin-top: 1em; }
.skill-llm strong { color: #84a6e1; font-weight: 600; }
.skill-llm em { color: var(--text-muted); font-style: italic; }
.skill-md code { background: #161D25; padding: 2px 4px; border-radius: 3px; font: 13px var(--mono); line-height: 1.9; color: var(--accent-hover); }
.skill-llm pre {
  background: var(--surface); padding: 16px; border-radius: 8px;
  border: 1px solid var(--border-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.skill-llm pre code { background: transparent; padding: 0; color: var(--text); white-space: pre-wrap; }
/* Tables — unified across human and LLM sections. Full-width, slightly
   smaller font than body, thin row separators, tight padding. */
.skill-md table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.45;
}
.skill-md table th,
.skill-md table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid #232C38;
  vertical-align: top;
}
.skill-md table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #232C38;
}
.skill-md table tr:last-child td { border-bottom: none; }
.skill-md table code {
  font-size: 12px;
  padding: 1px 5px;
}

/* Lists — unified across human and LLM sections so spacing and indentation
   read as one consistent body. */
.skill-md ul, .skill-md ol {
  padding-left: 26px;
  margin: 0 0 14px;
}
.skill-md ul { list-style: disc; }
.skill-md ol { list-style: decimal; }
.skill-md li {
  margin: 0 0 4px;
  line-height: 1.6;
  padding-left: 4px;
}
.skill-md li::marker { color: var(--text-dim); }
.skill-md li > p { margin: 0 0 4px; }
.skill-md li > p:last-child { margin-bottom: 0; }
.skill-md li > ul, .skill-md li > ol { margin-top: 4px; margin-bottom: 0; }

/* Blockquotes — tight, accent rule on the left, italic body. */
.skill-md blockquote {
  margin: 0.6em 0;
  padding: 4px 14px;
  border-left: 3px solid #84a6e1;
  color: var(--text-soft);
  font-style: italic;
}
.skill-md blockquote p { margin: 0 0 6px; }
.skill-md blockquote p:last-child { margin-bottom: 0; }

/* Fenced code blocks (```...```) — give them breathing room after the
   closing fence so the next paragraph isn't kissing the bottom edge. */
.skill-md pre { margin: 0 0 15px; }

/* Rail section — uniform stack treatment across rating / files / versions.
   Each section is a labeled group with a small-caps heading on top and a
   thin border-top above (except the first), giving the column a calm
   editorial rhythm instead of a stack of mismatched cards. */
.rail-section {
  display: flex; flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border-1);
}
.rail-section:first-child {
  padding-top: 0;
  border-top: none;
}
.rail-heading,
.edit-side label.muted {
  font: 600 10px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0;
}
/* Retooled versions list — clean stacked rows, no inherited <ul>/<li>
   weirdness, deterministic 6px between rows. */
.rail-versions { display: flex; flex-direction: column; gap: 6px; }
.rail-versions__row {
  display: flex; flex-wrap: nowrap; align-items: baseline; gap: 6px;
  line-height: 1;
  font: 12px var(--mono);
  color: var(--text);
  white-space: nowrap;
}
.rail-versions__semver { font-weight: 500; }
.rail-versions__when { color: var(--text-muted); font-family: var(--sans); font-size: 11px; }
.rail-versions__dl {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border-3);
  color: #6e9ecf;
  text-decoration: none;
  margin-left: auto;
  transition: all 0.18s ease;
}
.rail-versions__dl:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

/* Upload */
.upload-card { max-width: 640px; margin: 32px auto; padding: 0 28px; }
.dropzone {
  border: 2px dashed var(--border-4); border-radius: 12px;
  padding: 48px 24px; text-align: center; color: var(--text-muted);
}
.dropzone.dragover { border-color: var(--accent); color: var(--accent); }
.upload-form input[type=file] { display: none; }
.upload-form label.file-btn {
  display: inline-block; background: var(--surface); border: 1px solid var(--border-4);
  color: var(--text); padding: 8px 14px; border-radius: 6px; cursor: pointer; margin-top: 12px;
}
.upload-form button:not(.tab):not(.action-btn):not(.chip-x) {
  margin-top: 18px; background: var(--accent); color: var(--accent-on);
  border: none; padding: 10px 16px; border-radius: 6px; font-weight: 600;
}
.field-error { color: var(--danger); font-size: 12px; margin-top: 6px; }
.upload-form .field { margin-bottom: 14px; }
/* Restrict to the bare upload page — the edit form (.upload-form.edit-form)
   has its own sidebar with CAPS heading labels that shouldn't be coerced
   to 12px. */
.upload-form:not(.edit-form) .field label { display:block; margin-bottom:6px; font-size:12px; }
.upload-form .field select {
  width:100%; padding:8px 10px;
  background:var(--surface); color:var(--text);
  border:1px solid var(--border-3); border-radius:6px;
  font:13px var(--sans);
}
.upload-form .field select[multiple] { height:auto; }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 216px 1fr; min-height: calc(100vh - 90px); }
/* Mirror the catalog filter sidebar (.filter-side) so admin nav matches
   the rest of the site: no surface panel, uppercase section headers,
   compact pill rows with a subtle active state. */
.admin-side { border-right: 1px solid var(--border-2); padding: 24px 20px; display: flex; flex-direction: column; gap: 4px; }
.admin-nav-group { display: flex; flex-direction: column; gap: 1px; }
.admin-side h4 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 20px 0 8px; font-weight: 600;
}
.admin-nav-group:first-child h4 { margin-top: 0; }
.admin-side a {
  display: flex; align-items: center;
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; color: var(--text-soft);
  border: 1px solid transparent;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.admin-side a:hover { background: var(--surface); color: var(--text); }
.admin-side a[aria-current="page"] {
  background: var(--surface-2); border-color: var(--border-4); color: var(--text);
  font-weight: 600;
}
.admin-main { padding: 28px 32px; max-width: 1120px; }
.admin-main h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 10px; }
.admin-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin: 26px 0 4px; font-weight: 700; }
.origin-tag { display: inline-block; font: 600 10px/1.3 var(--sans); text-transform: uppercase; letter-spacing: 0.07em; padding: 4px 8px; border-radius: 6px; margin-left: 8px; vertical-align: middle; }
.origin-tag--upload { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border-3); }
.origin-tag--observer { background: rgba(110, 158, 207, 0.20); color: #B6D0EC; border: 1px solid rgba(110, 158, 207, 0.45); }
.admin-card { background: var(--surface); border: 1px solid var(--border-3); border-radius: 8px; padding: 16px; display: block; }
.admin-card:hover { border-color: var(--accent); }
.admin-card h3 { font-size: 14px; margin-bottom: 4px; }
.admin-card p { margin: 0; font-size: 12px; }
.admin-table { width: 100%; margin-top: 18px; border-collapse: collapse; }
.admin-table th { text-align: left; color: var(--text-dim); font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; padding: 8px 0; }
.admin-table td { padding: 10px 0; border-top: 1px solid var(--border-1); font-size: 13px; }
/* Compact at-a-glance stat tiles for the admin dashboard. */
.stat-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.stat { flex: 1 1 110px; min-width: 100px; background: var(--surface-2);
  border: 1px solid var(--border-3); border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px; }
.stat__num { font: 700 22px/1 var(--sans); color: var(--text); }
.stat__label { font: 11px/1.2 var(--sans); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); }
.stat--warn .stat__num { color: var(--accent-hover); }
.stat-breakdown { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px;
  font: 12px/1 var(--sans); color: var(--text-muted); }
.stat-breakdown strong { color: var(--text); font-weight: 700; }

.admin-form { display: flex; gap: 8px; align-items: center; margin: 14px 0 22px; }
.admin-form input, .admin-form select { background: var(--bg); border: 1px solid var(--border-3); border-radius: 6px; padding: 7px 10px; color: var(--text); font: 13px var(--sans); }
.admin-form button { background: var(--accent); color: var(--bg); border: none; border-radius: 6px; padding: 7px 14px; font-weight: 600; font-size: 12px; cursor: pointer; }
.admin-actions form { display: inline; }
.admin-actions button { background: transparent; border: 1px solid var(--border-3); color: var(--text-muted); border-radius: 4px; padding: 3px 8px; font: 11px var(--mono); cursor: pointer; }
.admin-actions button:hover { color: var(--danger); border-color: var(--danger); }

/* Row tag/team bubbles (added by polish pass) */
.skill-row-info { min-width: 0; }
.row-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.row-stats {
  margin-top: 15px;
  font: 10px var(--mono);
  color: #c9d1d9;
  letter-spacing: 0.02em;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.row-stats-sep { color: var(--border-3); }
.row-stat-value.is-active { color: #be5a1c; }
.row-stat-muted { color: var(--text-dim); }
.row-stat-author { color: #ffffff; }

/* Skill detail — stats line right below the H1 */
.detail-stats {
  margin: 4px 0 14px;
  font: 12px var(--mono);
  color: var(--text-dim);
  letter-spacing: 0.02em;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.detail-stats-sep { color: var(--border-3); }
.detail-stat-value.is-active { color: #be5a1c; }

/* Deploy-indicator next to the title — yellow bolt, transparent
   background, sits inline ahead of the skill/plugin name. Same icon shows up
   to the left of the title on browse rows when a skill is deployed. */
.deploy-indicator {
  display: inline-flex; align-items: center; vertical-align: middle;
  margin-right: 11px;
  transform: translateY(-1px);
}
.deploy-indicator svg { display: block; }
.skill-detail-head .deploy-indicator svg { width: 19px; height: 19px; }
h3 .deploy-indicator { margin-right: 9px; }
h3 .deploy-indicator svg { width: 13px; height: 13px; }
.detail-stat-muted { color: var(--text-dim); }
.detail-stat-author { color: #ffffff; }

/* Interactive 0.5-step rating widget on the detail page. Implemented as
   10 small half-star buttons in two interleaved tracks. CSS-only fill
   based on the .filled class set by JS. */
.rating-widget {
  display: flex; flex-direction: column; gap: 8px;
}
.rating-label {
  /* Matches .rail-heading exactly so the rating section reads like the
     others (Skill Files, Versions). Keep them visually identical. */
  font: 600 10px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.rating-author-note {
  font: 12px/1.45 var(--sans);
  color: var(--text-muted);
}
.rating-stars { display: inline-flex; }
.rating-half {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0; margin: 0;
  width: 13px; height: 26px;
  cursor: pointer;
  position: relative;
  overflow: hidden;          /* clips the wide star glyph to this half-button */
  outline: none;
}
.rating-half::before {
  /* The star glyph is wider than the button. We render a FULL 26px-wide
     star and slide it left/right so each button reveals exactly half. */
  content: "★";
  position: absolute;
  top: 0;
  width: 26px; height: 26px;
  font-size: 26px; line-height: 26px;
  text-align: center;
  color: var(--border-3);
  pointer-events: none;
  transition: color 0.12s ease;
}
/* Odd halves show the LEFT half of a fresh star (positioned at left:0).
   Even halves show the RIGHT half of THAT same star (shifted left by 13px
   so the right half lands inside this button). */
.rating-half:nth-child(odd)::before  { left: 0; }
.rating-half:nth-child(even)::before { left: -13px; }
.rating-half.filled::before { color: #facc15; }       /* warm gold */
.rating-half:hover::before  { color: #fde68a; }       /* lighter on hover */
.rating-value {
  font: 11px var(--mono);
  color: var(--text-soft);
  letter-spacing: 0.04em;
}
.bubble {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font: 10px/1.5 var(--mono);
  letter-spacing: 0.02em;
}
.bubble-tag {
  background: var(--surface-2);
  color: var(--text-soft);
  border: 1px solid var(--border-3);
}
.bubble-team {
  color: #ffffff;
  background: #4c5c6d;
  opacity: 1;
}

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 2px solid var(--accent); margin-bottom: 22px; }
.tab {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border-2);
  border-bottom: none;
  padding: 5px 9px; cursor: pointer;
  font: 13px var(--sans);
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab-active {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
  margin-bottom: -2px;
}
/* Dense file-tab variant for plugin bundles — wraps to multiple rows so a
   30-file bundle doesn't bleed into the right rail. The smaller font + tight
   padding keeps each tab readable without dominating the page. */
.tabs.tabs-dense { gap: 3px 3px; row-gap: 3px; margin-bottom: 18px; }
.tabs.tabs-dense .tab {
  font: 7pt var(--sans);
  padding: 3px 7px;
  border-radius: 4px 4px 0 0;
  line-height: 1.3;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs.tabs-dense .tab-active { margin-bottom: -2px; }
.tab-panel { display: none; }
.tab-panel-active { display: block; }

/* Edit form */
.edit-form .field { margin-bottom: 18px; }
/* Default form label inside the edit form — only applies to main-column
   fields (Title, Description, etc). Sidebar labels keep their .rail-heading
   styling via .edit-side label.muted above. */
.edit-form .edit-main .field label { display:block; margin-bottom: 6px; font-size: 12px; }
/* Interactive control labels keep their own layout — the caption rule above
   would otherwise force them to display:block and collapse the control. */
.edit-form .edit-main .field label.switch { display: inline-flex; margin-bottom: 0; }
.edit-form .edit-main .field label.radio-card { display: flex; margin-bottom: 0; }
.edit-form .field input[type=text],
.edit-form .field select,
.upload-form .field input[type=text],
.upload-form .field select {
  width: 100%; padding: 8px 10px;
  /* Darker than --surface so form inputs sit as recessed surfaces against
     the page background, matching the .md-textarea treatment. */
  background: #161D25; color: var(--text);
  border: 1px solid var(--border-3); border-radius: 6px;
  font: 13px var(--sans);
}
.edit-form .field select[multiple] { height: auto; }
.edit-form .field input[type=text]:disabled,
.edit-form .field select:disabled { opacity: 0.55; cursor: not-allowed; }

/* Guide page — single-scrolling layout with a sticky TOC on the left. */
.guide-shell {
  max-width: 1180px;
  margin: 32px auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 48px;
}
.guide-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  font-size: 12px;
}
.guide-toc h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 0 0 12px;
  font-weight: 600;
}
.guide-toc a {
  display: block;
  padding: 4px 0;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0;
}
.guide-toc a:hover { color: var(--accent-hover); }
.guide-body { min-width: 0; }
.guide-section {
  scroll-margin-top: 24px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 36px;
}
.guide-section:last-child { border-bottom: none; }
.guide-section h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--text);
}
.guide-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 22px 0 8px;
  color: #6e9ecf;
}
.guide-section h4 {
  margin-top: 18px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--accent);
}
.guide-section p, .guide-section li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-soft);
  margin-bottom: 10px;
}
.guide-section ul, .guide-section ol { margin-left: 22px; }
.guide-section code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 3px;
  font: 12px var(--mono);
  color: var(--text);
}
.guide-section pre {
  background: var(--surface);
  padding: 14px 18px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  font: 12px/1.55 var(--mono);
  color: var(--text);
  overflow-x: auto;
  margin: 12px 0;
}
.guide-section pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 12px;
}
.guide-section a { color: var(--accent-hover); text-decoration: none; }
.guide-section a:hover { text-decoration: underline; }
.guide-lede {
  font-size: 16px !important;
  line-height: 1.55;
  color: var(--text) !important;
  margin: 0 0 18px !important;
}
@media (max-width: 900px) {
  .guide-shell { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
}

/* Edit page two-column layout */
/* Match .skill-detail's sizing model exactly — content-box max-width so the
   1180px applies to the inner content area, not the padded box. Without
   this both view and edit pages declared "max-width: 1180px" but the edit
   shell's border-box treatment was eating 56px off the content area
   (the 28px horizontal padding × 2 was counted inside max-width). View
   and edit now render at identical widths. */
.edit-shell { max-width: 1180px; margin: 16px auto 32px; padding: 16px 28px 80px; }
.edit-main button[type="submit"] { margin-top: 16px; padding: 10px 18px; }
.edit-head { display:flex; align-items:baseline; justify-content:space-between; gap: 16px; margin-bottom: 6px; }
.edit-head__titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.edit-head__eyebrow {
  font: 600 10px/1 var(--sans); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
}
.edit-head__titles h1 {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.edit-head-actions { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; }
.edit-head-actions .action-btn.primary {
  background: var(--accent); color: var(--accent-on);
  border: 1px solid var(--accent);
  padding: 8px 18px; border-radius: 6px;
  font: 600 12px var(--sans); letter-spacing: 0.01em;
  cursor: pointer; text-decoration: none;
}
.edit-head-actions .action-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
/* Flex row — same recipe as .skill-detail-grid for the same reasons.
   The narrow sidebar is locked at 235px on the left, main fills the
   rest and can shrink below its intrinsic content. */
.edit-grid {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  margin-top: 24px;
}
.edit-grid > .edit-side {
  flex: 0 0 235px;
  order: -1;
  max-width: 235px;
}
.edit-grid > .edit-main {
  flex: 1 1 0;
  min-width: 0;
}
.edit-side {
  position: sticky; top: 16px; padding-top: 4px; min-width: 0;
  display: flex; flex-direction: column;
  gap: 24px;  /* matches .skill-detail-rail so sections breathe identically */
}
/* Mirror .rail-section on the detail view: thin divider above each group,
   small CAPS label on top, generous breathing room. The first field skips
   the divider so the column doesn't start with a stray line. */
.edit-side .field {
  display: flex; flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  padding-bottom: 0;
  margin-bottom: 0;
  border-top: 1px solid var(--border-1);
}
.edit-side .field:first-child {
  padding-top: 0;
  border-top: none;
}
/* The .hint span lives inside an uppercased label; reset it so it stays in
   sentence-case at smaller weight without inheriting the heading transform. */
.edit-side label.muted .hint {
  text-transform: none;
  letter-spacing: normal;
  font-weight: normal;
}
.edit-main .field { margin-bottom: 22px; }
.edit-side select, .edit-side input { width: 100%; max-width: 100%; box-sizing: border-box; }
.edit-form .hint { font-size: 11px; color: var(--text-dim); font-weight: normal; }
.md-textarea {
  display: block;  /* default <textarea> is inline-block which can leave
                      the element narrower than its container when the
                      browser respects the implicit cols=20 attribute */
  width: 100%; box-sizing: border-box; min-height: 280px;
  /* Darker than --bg so the textarea sits as a recessed surface on
     skill / plugin / kb-article / mcp edit pages — same #161D25 the
     frontmatter card uses on view pages. */
  background: #161D25; color: var(--text);
  border: 1px solid var(--border-3); border-radius: 8px;
  padding: 14px 16px; font: 13px/1.6 var(--mono); resize: vertical;
}
.md-textarea-llm { min-height: 360px; }
.guide-panel code { background: var(--surface); padding: 1px 6px; border-radius: 3px; font: 12px var(--mono); color: var(--text); }

/* Browse title size bump */
.skill-row h3 { font-size: 20px; font-weight: 400; letter-spacing: -0.005em; }
.skill-row h3 a { display: inline-block; }
.skill-row h3 a { color: #6e9ecf; transition: color 0.15s ease; }
.skill-row h3 a:hover { color: var(--accent-hover); }
.skill-row p { color: #ffffff; font-size: 13px; line-height: 1.7; margin-top: 2px; overflow-wrap: anywhere; }

/* Row action icon — flat dark surface, light-blue accent on hover. Same look
   applies to Copy / Download / Add-to-Claude / Bookmark across every browse
   row (skills, plugins, KB articles, MCP servers). */
.down-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--border-3);
  border-radius: 4px;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.18s ease;
}
.down-icon:hover {
  background: var(--surface-2);
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}
/* Logout icon button */
.user-pill button {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-4);
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.user-pill button:hover { color: var(--accent-hover); border-color: var(--accent-hover); }

/* Admin icon button — square, head+shoulders glyph, sits left of logout */
.admin-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-4);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.18s ease;
}
.admin-pill:hover { color: var(--accent-hover); border-color: var(--accent-hover); }
.admin-pill.active { color: var(--accent-on); background: var(--accent); border-color: var(--accent); }

/* Help icon button — sits to the right of the search box, before admin. */
.help-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-4);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.18s ease;
}
.help-pill:hover { color: var(--accent-hover); border-color: var(--accent-hover); }
.help-pill.active { color: var(--accent-on); background: var(--accent); border-color: var(--accent); }

/* Profile icon button — sits between admin and logout. */
.profile-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-4);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.18s ease;
}
.profile-pill:hover { color: var(--accent-hover); border-color: var(--accent-hover); }
.profile-pill.active { color: var(--accent-on); background: var(--accent); border-color: var(--accent); }

/* My AI (plug) + Deploy (bolt): fill the ICON yellow when active. */
.myai-icon.is-my-ai svg,
.deploy-icon.is-deployed svg { fill: var(--highlight-yellow); stroke: var(--highlight-yellow); }
.action-btn.icon-only.myai-icon.is-my-ai,
.action-btn.icon-only.deploy-icon.is-deployed { border-color: var(--highlight-yellow); }
/* Title badge to the left of skill/plugin names: yellow bolt, white edge. */
.deploy-indicator svg { fill: var(--highlight-yellow); stroke: #ffffff; }

/* Search clear button */
.search-input-wrap { position: relative; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--text-muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 4px 6px;
  border-radius: 4px;
}
.search-clear:hover { color: var(--text); background: var(--surface-2); }

/* Toast notification */
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 99;
  background: var(--accent);
  color: var(--accent-on);
  padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: 13px;
  box-shadow: 0 6px 24px rgba(11, 31, 42, 0.45);
  animation: toast-life 2.5s ease forwards;
}
@keyframes toast-life {
  0%   { transform: translateY(8px); opacity: 0; }
  10%  { transform: translateY(0);   opacity: 1; }
  85%  { transform: translateY(0);   opacity: 1; }
  100% { transform: translateY(-6px); opacity: 0; pointer-events: none; }
}

/* Subtle page reveal */
.app-main { animation: page-reveal 0.4s ease both; }
@keyframes page-reveal {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Atmospheric depth on bg */
html, body {
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(37, 135, 174, 0.07), transparent),
    var(--bg);
  background-attachment: fixed;
}

/* Browse toolbar — sort buttons left, page-links right, on the same row
   above the first result. Underlined with a barely-visible 1px rule that
   separates the controls from the result list below. */
.browse-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  /* Pull the rule to the full width of the browse-main column: -30px
     cancels .browse-main's horizontal padding so the bottom border runs
     from the left filter-side boundary all the way to the right viewport
     edge. Padding restores the content inset so the buttons stay aligned
     with the rest of the column. Single border-bottom only — there's
     already a header/page divider above the toolbar; a second rule on top
     created a doubled line. */
  margin: 10px -30px 14px;
  padding: 4px 30px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Standardized "back" link — small caret triangle + text. Used on every
   detail/edit page for "All plugins" / "All MCP servers" / "Back to KB"
   etc so they all read identically. */
.back-link {
  font-size: 12px;
  color: var(--text-dim);
  margin: 24px 0 8px;
}
.back-link a {
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.back-link a:hover { color: var(--accent-hover); }
.back-link__arrow {
  font-size: 18px;
  line-height: 1;
  opacity: 0.85;
}
.browse-toolbar__pagination .page-links { justify-content: flex-end; }

/* Pagination */
.pagination {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
  margin: 32px 0 10px;
}
.per-page-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  margin-top: 10px;
}
/* Bottom per-page selector — right-justified. Spacing mirrors .browse-toolbar
   so the top and bottom rules form a symmetric frame around the list:
     top rule: padding 5px above buttons / 10px below, margin 5px below rule
     bot rule: margin 5px above rule, padding 10px above buttons / 5px below
   Both use the same -30px horizontal margins so the rule spans from the
   left vert filter-side line to the right viewport edge. */
.per-page-wrap--bottom {
  flex-direction: row; align-items: center; justify-content: space-between;
  gap: 10px;
  margin: 5px -30px 0;
  padding: 10px 30px 5px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.per-page-group { display: flex; align-items: center; gap: 10px; }
.bottom-page-links .page-links { justify-content: flex-end; }
.per-page-label {
  font: 10px/1 var(--mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.page-links {
  display: flex; flex-wrap: wrap; gap: 4px;
  list-style: none; padding: 0; margin: 0;
  justify-content: center;
}
.page-links li.page-gap {
  color: var(--text-dim);
  padding: 6px 10px;
  font: 12px var(--mono);
}
.page-link {
  display: inline-block;
  min-width: 22px; padding: 5px 7px;
  border-radius: 3px;
  border: 1px solid var(--border-3);
  background: transparent;
  color: var(--text-soft);
  font: 10px/1 var(--mono);
  text-align: center;
  transition: all 0.15s ease;
}
.page-link:hover { border-color: var(--accent-hover); color: var(--accent-hover); }
.page-link.is-current {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.per-page {
  display: inline-flex;
  border: 1px solid var(--border-3);
  border-radius: 4px;
  overflow: hidden;
}
.per-link {
  padding: 4px 10px;
  font: 10px/1 var(--mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-right: 1px solid var(--border-3);
}
.per-link:last-child { border-right: none; }
.per-link:hover { background: var(--surface); color: var(--text); }
.per-link.is-current {
  background: var(--accent);
  color: var(--accent-on);
}

/* ---------------------------------------------------------------------------
   MCP one-click install block (rendered on /mcp landing + skill detail page).
   ------------------------------------------------------------------------ */
.mcp-install {
  margin: 24px 0 8px;
  padding: 20px;
  border: 1px solid var(--border-3);
  border-radius: 8px;
  background: var(--surface);
}
.mcp-install__pickyour {
  margin: 0 0 12px;
  font: 600 12px/1.2 var(--sans);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mcp-install__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 12px;
}
.mcp-install__card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid var(--border-3);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.mcp-install__card:hover,
.mcp-install__card:focus-visible {
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}
.mcp-install__card--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.mcp-install__card--primary:hover,
.mcp-install__card--primary:focus-visible {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--accent-on);
}
.mcp-install__card.is-copied {
  background: #2f7a4f !important;
  border-color: #2f7a4f !important;
  color: #ffffff !important;
}
.mcp-install__card-kicker {
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}
.mcp-install__card-title {
  font: 600 16px/1.2 var(--sans);
}
.mcp-install__card-sub {
  font: 12px/1.3 var(--sans);
  opacity: 0.85;
}
.mcp-install__card-sub code {
  font: 12px/1 var(--mono);
  background: rgba(0,0,0,0.15);
  padding: 1px 4px;
  border-radius: 3px;
  color: inherit;
}
.mcp-install__web-hint {
  margin: 0 0 8px;
  font: 12px/1.5 var(--sans);
  color: var(--text-muted);
}
.mcp-install__web-hint em {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
}
.mcp-install__copy {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-on);
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mcp-install__copy:hover,
.mcp-install__copy:focus-visible { background: var(--accent-deep); }
.mcp-install__copy.is-copied { background: #2f7a4f; border-color: #2f7a4f; }
.mcp-install__copy.is-copied::after { content: " ✓"; }
.mcp-install__btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-hover);
  font: 600 12px/1 var(--sans);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.mcp-install__btn-secondary:hover,
.mcp-install__btn-secondary:focus-visible {
  background: var(--accent);
  color: var(--accent-on);
}
.mcp-install__hint {
  margin: 0 0 8px;
  font: 12px/1.4 var(--sans);
  color: var(--text-muted);
}
.mcp-install__row {
  display: flex; align-items: stretch; gap: 8px;
}
.mcp-install__row pre { flex: 1; margin: 0; }
.mcp-install__manual { margin-top: 18px; }
.mcp-install__manual > summary {
  cursor: pointer;
  font: 12px/1.4 var(--sans);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
  list-style: none;
}
.mcp-install__manual > summary::-webkit-details-marker { display: none; }
.mcp-install__manual > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}
.mcp-install__manual[open] > summary::before { content: "▾ "; }
.mcp-install__manual h4 {
  margin: 14px 0 6px;
  font: 600 12px/1.2 var(--sans);
  color: var(--text);
  letter-spacing: 0.02em;
}
.mcp-install__manual pre {
  margin: 0;
  padding: 10px 12px;
  background: #161D25;
  border: 1px solid var(--border-3);
  border-radius: 6px;
  overflow-x: auto;
  font: 12px/1.5 var(--mono);
  color: var(--accent-hover);
}
.mcp-install__manual pre code { background: none; padding: 0; color: inherit; }
.mcp-install__manual h4 code {
  font: 600 11px/1 var(--mono);
  color: var(--text-muted);
  background: none;
  padding: 0;
}

/* Per-row 'Add to Claude' dropdown on the browse listing. */
.row-mcp {
  position: relative;
  display: inline-block;
}
/* Install trigger — wider than the other action icons because it shows three
   client logos (Claude / OpenAI / Microsoft Copilot) side-by-side. */
.down-icon.mcp-icon {
  list-style: none;
  width: auto;
  padding: 0 8px;
}
.down-icon.mcp-icon::-webkit-details-marker { display: none; }
.down-icon.mcp-icon::marker { content: none; }
.mcp-icon__row {
  display: inline-flex; align-items: center; gap: 5px;
}
.mcp-icon__logo {
  width: 13px; height: 13px;
  flex: none;
}
/* Open state — strong fill so users see the dropdown is currently expanded. */
.row-mcp[open] > .down-icon.mcp-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.row-mcp__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--border-3);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  display: flex; flex-direction: column; gap: 4px;
}
/* Detail-page actions live in the LEFT rail — flip the dropdown anchor so
   it opens to the RIGHT of the button instead of off-screen left. */
.skill-detail-rail .row-mcp__menu {
  left: 0;
  right: auto;
}
.row-mcp__item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.row-mcp__item:hover,
.row-mcp__item:focus-visible {
  background: rgba(255,255,255,0.04);
  border-color: var(--accent-hover);
  outline: none;
}
.row-mcp__item--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.row-mcp__item--primary:hover,
.row-mcp__item--primary:focus-visible {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--accent-on);
}
.row-mcp__item.is-copied {
  background: #2f7a4f !important;
  border-color: #2f7a4f !important;
  color: #ffffff !important;
}
.row-mcp__item-kicker {
  font: 600 9px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.row-mcp__item-title {
  font: 600 13px/1.2 var(--sans);
}
.row-mcp__item-sub {
  font: 11px/1.3 var(--sans);
  opacity: 0.8;
}
.row-mcp__item-sub code {
  font: 11px/1 var(--mono);
  background: rgba(0,0,0,0.15);
  padding: 1px 4px;
  border-radius: 3px;
  color: inherit;
}

/* Chip + "+" Add picker used for skill↔KB, skill↔MCP, MCP↔KB linkage on
   edit pages. Assigned items render as removable chips; the "+ Add" button
   opens a dropdown listing remaining unassigned items. */
.add-picker__chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px; margin-bottom: 6px;
  min-height: 4px;
}
.add-picker__chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-3);
  color: var(--text-soft);
  padding: 2px 4px 2px 8px;
  border-radius: 5px;
  font: 11px/1.4 var(--sans);
  letter-spacing: 0.01em;
}
.add-picker__chip .chip-x {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; line-height: 1;
  padding: 0 4px; margin-left: 2px;
  border-radius: 3px;
}
.add-picker__chip .chip-x:hover { color: var(--danger); }

.add-picker__add { position: relative; display: inline-block; }
.add-picker__btn {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border: 1px dashed var(--border-3);
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font: 11px var(--sans);
  cursor: pointer; user-select: none;
  list-style: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.add-picker__btn:hover {
  background: var(--surface-2);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}
.add-picker__btn::-webkit-details-marker { display: none; }
.add-picker__btn::marker { content: none; }
.add-picker__add[open] > .add-picker__btn {
  background: var(--accent);
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent-on);
}
.add-picker__menu {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  z-index: 20;
  min-width: 240px; max-width: 360px;
  max-height: 280px; overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border-3);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  display: flex; flex-direction: column; gap: 2px;
}
/* High specificity + !important so these option buttons can't be hijacked by
   any broad button rule that reaches into the edit form. */
.add-picker .add-picker__menu .add-picker__option {
  display: block !important; width: 100%; text-align: left;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--text) !important;
  font: 400 13px/1.35 var(--sans) !important;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.add-picker .add-picker__menu .add-picker__option:hover,
.add-picker .add-picker__menu .add-picker__option:focus-visible {
  background: var(--surface-2) !important;
  border-color: var(--border-3) !important;
  outline: none;
}
.add-picker__option .picker-scope,
.add-picker__chip .picker-scope {
  color: var(--text-dim); font-size: 11.5px; font-weight: 400; margin: 0;
}
/* dark scrollbar — replaces the OS-default white one on the menu */
.add-picker__menu { scrollbar-width: thin; scrollbar-color: var(--border-4) transparent; }
.add-picker__menu::-webkit-scrollbar { width: 10px; }
.add-picker__menu::-webkit-scrollbar-track { background: transparent; }
.add-picker__menu::-webkit-scrollbar-thumb {
  background: var(--border-4); border-radius: 6px;
  border: 2px solid var(--surface);
}
.add-picker__menu::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.add-picker__empty { font: 11px var(--sans); padding: 8px 4px; margin: 0; }
.add-picker__option:not([hidden]) ~ .add-picker__empty { display: none; }
.add-picker__menu:not(:has(.add-picker__option:not([hidden]))) .add-picker__empty { display: block; }

/* ---------------------------------------------------------------------------
   /install landing — "don't know where to start" friendly UX.
   Hero + ONE giant primary button + collapsible alternatives.
   ------------------------------------------------------------------------ */
.install-hero {
  max-width: 760px;
  margin: 16px auto 32px;
  text-align: center;
}
.install-hero__title {
  margin: 0 0 12px;
  font: 700 32px/1.2 var(--sans);
  color: var(--text);
}
.install-hero__lede {
  margin: 0;
  font: 16px/1.55 var(--sans);
  color: var(--text-muted);
}
.install-hero__lede em {
  font-style: normal;
  color: var(--text);
  background: rgba(60,90,121,0.18);
  padding: 1px 6px;
  border-radius: 4px;
}

.install-primary {
  max-width: 760px;
  margin: 0 auto 32px;
  text-align: left;
}
.install-primary__connector {
  padding: 20px 22px;
  border: 1px solid var(--border-3);
  border-radius: 10px;
  background: var(--surface);
}
.install-primary__kicker {
  display: block;
  margin-bottom: 4px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.install-primary__connector-heading {
  margin: 0 0 8px;
  font: 700 20px/1.25 var(--sans);
  color: var(--text);
}
.install-primary__connector-lede {
  margin: 0 0 14px;
  font: 14px/1.55 var(--sans);
  color: var(--text-muted);
}
.install-url-row {
  display: flex; align-items: stretch; gap: 8px;
  margin: 0 0 18px;
}
.install-url-row pre {
  flex: 1; margin: 0; padding: 9px 14px;
  border: 1px solid var(--border-4); border-radius: 8px;
  background: rgba(0,0,0,0.22);
  overflow-x: auto;
}
.install-url-row pre code { font: 13px/1.5 var(--mono); color: var(--text); }
.install-url-row--inline { margin: 8px 0 0; }
.install-steps {
  border-top: 1px solid var(--border-4);
}
.install-step {
  display: grid; grid-template-columns: 150px 1fr;
  gap: 14px; align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-4);
  font: 14px/1.55 var(--sans);
}
.install-step__client { font-weight: 600; color: var(--text); }
.install-step__how { color: var(--text-muted); }
.install-step__how .install-url-row { display: flex; }
.install-primary__org-note {
  margin: 16px 0 0; padding: 10px 14px;
  border: 1px dashed var(--border-3); border-radius: 8px;
  font: 13px/1.55 var(--sans); color: var(--text-muted);
}
.install-primary__org-note em { font-style: normal; color: var(--text); }
.install-primary__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 32px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-on);
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.install-primary__btn:hover,
.install-primary__btn:focus-visible {
  background: var(--accent-deep);
  transform: translateY(-1px);
}
.install-primary__btn-kicker {
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
}
.install-primary__btn-title {
  font: 700 24px/1.2 var(--sans);
}
.install-primary__btn-title::before {
  content: "↓ ";
  opacity: 0.85;
}
.install-primary__btn-sub {
  font: 14px/1.5 var(--sans);
  opacity: 0.9;
  max-width: 460px;
}
.install-primary__help {
  margin: 16px 0 0;
  font: 13px/1.5 var(--sans);
  color: var(--text-muted);
}
.install-primary__help a {
  color: var(--accent-hover);
}

.install-alt {
  max-width: 760px;
  margin: 0 auto 32px;
  padding: 18px 22px;
  border: 1px solid var(--border-3);
  border-radius: 10px;
  background: var(--surface);
}
.install-alt > summary {
  cursor: pointer;
  font: 600 14px/1.3 var(--sans);
  color: var(--text);
  list-style: none;
  user-select: none;
}
.install-alt > summary::-webkit-details-marker { display: none; }
.install-alt > summary::before {
  content: "▸ ";
  display: inline-block;
}
.install-alt[open] > summary::before { content: "▾ "; }
.install-alt__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.install-alt__card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-3);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.install-alt__card:hover,
.install-alt__card:focus-visible {
  background: rgba(255,255,255,0.04);
  border-color: var(--accent-hover);
  outline: none;
}
.install-alt__card.is-copied {
  background: #2f7a4f !important;
  border-color: #2f7a4f !important;
  color: #ffffff !important;
}
.install-alt__card-title {
  font: 600 15px/1.2 var(--sans);
}
.install-alt__card-sub {
  font: 12px/1.5 var(--sans);
  color: var(--text-muted);
}
.install-alt__card-sub a { color: var(--accent-hover); }
.install-alt__card-sub em {
  font-style: normal; font-weight: 600; color: var(--text);
}
.install-alt__card-sub code,
.install-alt__hint code {
  font: 12px/1 var(--mono);
  background: rgba(0,0,0,0.2);
  padding: 1px 4px;
  border-radius: 3px;
  color: inherit;
}
.install-alt__nested {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border-3);
}
.install-alt__nested > summary {
  cursor: pointer;
  font: 600 12px/1.3 var(--sans);
  color: var(--text-muted);
  list-style: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.install-alt__nested > summary::-webkit-details-marker { display: none; }
.install-alt__nested > summary::before { content: "▸ "; }
.install-alt__nested[open] > summary::before { content: "▾ "; }
.install-alt__nested h4 {
  margin: 14px 0 6px;
  font: 600 13px/1.2 var(--sans);
  color: var(--text);
}
.install-alt__hint {
  margin: 0 0 8px;
  font: 12px/1.4 var(--sans);
  color: var(--text-muted);
}
.install-alt__row {
  display: flex; align-items: stretch; gap: 8px;
}
.install-alt__row pre { flex: 1; margin: 0;
  padding: 10px 12px;
  background: #161D25;
  border: 1px solid var(--border-3);
  border-radius: 6px;
  overflow-x: auto;
  font: 12px/1.5 var(--mono);
  color: var(--accent-hover);
}
.install-alt__btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-hover);
  font: 600 12px/1 var(--sans);
  text-decoration: none;
}
.install-alt__btn-secondary:hover { background: var(--accent); color: var(--accent-on); }

.install-next {
  max-width: 760px;
  margin: 0 auto 60px;
  padding: 22px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}
.install-next h2 {
  margin: 0 0 12px;
  font: 600 18px/1.3 var(--sans);
  color: var(--text);
}
.install-next__steps {
  margin: 0 0 14px;
  padding-left: 22px;
  font: 14px/1.7 var(--sans);
  color: var(--text);
}
.install-next__steps em {
  font-style: normal;
  background: rgba(60,90,121,0.18);
  padding: 1px 6px;
  border-radius: 4px;
}
.install-next__hint {
  margin: 0;
  font: 13px/1.5 var(--sans);
  color: var(--text-muted);
}
.install-next__plus {
  display: inline-block;
  width: 18px; height: 18px;
  border: 1px solid var(--border-3);
  border-radius: 4px;
  text-align: center;
  line-height: 16px;
  font: 600 12px/1 var(--mono);
  color: var(--text-muted);
}

/* Nav CTA: highlighted "Install in Claude" link in the top nav.
   Visible to every signed-in user (not just admins/architects). */
.app-nav .nav-cta {
  margin-left: 8px;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: rgba(60,90,121,0.18);
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav .nav-cta:hover,
.app-nav .nav-cta:focus-visible {
  background: var(--accent);
  color: var(--accent-on);
}
.app-nav .nav-cta.is-current,
.app-nav .nav-cta[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-on);
}

/* Top-of-page banner on /browse-skills nudging users to install the
   whole catalog. Small, dismissible-feeling, not a hard sell. */
.browse-install-cta {
  display: flex; align-items: center; gap: 16px;
  margin: 8px 0 18px;
  padding: 12px 18px;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: linear-gradient(90deg,
    rgba(60,90,121,0.18) 0%, rgba(60,90,121,0.06) 100%);
}
.browse-install-cta__copy {
  flex: 1;
  font: 13px/1.45 var(--sans);
  color: var(--text);
}
.browse-install-cta__copy strong {
  display: inline-block; margin-right: 4px;
  color: var(--accent-hover);
}
.browse-install-cta__btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-on);
  font: 600 13px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.browse-install-cta__btn:hover,
.browse-install-cta__btn:focus-visible {
  background: var(--accent-deep);
}

/* Outdated-bundle nudges. Two surfaces:
   - install-outdated: full-bleed banner on /install (above the primary
     download button) when the user's installed version doesn't match.
   - browse-install-cta--warn: amber variant of the browse banner.
   Both push the user to /install — re-download replaces the .mcpb. */
.install-outdated {
  max-width: 760px;
  margin: 0 auto 18px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #c08a2a;
  background: linear-gradient(90deg,
    rgba(192,138,42,0.18) 0%, rgba(192,138,42,0.06) 100%);
  font: 13px/1.5 var(--sans);
  color: var(--text);
}
.install-outdated strong {
  color: #d6a247;
  margin-right: 4px;
}
.install-outdated code {
  font: 12px/1 var(--mono);
  background: rgba(0,0,0,0.25);
  padding: 1px 5px;
  border-radius: 3px;
}
.browse-install-cta--warn {
  border-color: #c08a2a;
  background: linear-gradient(90deg,
    rgba(192,138,42,0.18) 0%, rgba(192,138,42,0.06) 100%);
}
.browse-install-cta--warn .browse-install-cta__copy strong { color: #d6a247; }
.browse-install-cta--warn .browse-install-cta__copy code {
  font: 12px/1 var(--mono);
  background: rgba(0,0,0,0.25);
  padding: 1px 5px;
  border-radius: 3px;
}
.browse-install-cta--warn .browse-install-cta__btn {
  background: #c08a2a;
}
.browse-install-cta--warn .browse-install-cta__btn:hover,
.browse-install-cta--warn .browse-install-cta__btn:focus-visible {
  background: #a07520;
}

/* /admin/rbac page — role assignments, team owners, active policy,
   and interactive decision tester. */
.rbac-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; margin-bottom: 28px;
}
.rbac-head h2 { margin: 0 0 6px; font: 600 22px/1.2 var(--sans); }
.rbac-head__sub { margin: 0; max-width: 640px;
  font: 13px/1.55 var(--sans); color: var(--text-muted); }
.rbac-head__sub code { font: 12px var(--mono); background: rgba(0,0,0,0.2);
  padding: 1px 5px; border-radius: 3px; }
.rbac-mode {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 14px;
  border: 1px solid var(--border-3); border-radius: 8px;
  background: var(--surface);
  min-width: 220px;
}
.rbac-mode__label { font: 600 10px/1 var(--sans);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.rbac-mode__value { font: 600 13px/1.2 var(--mono); }
.rbac-mode__value--opa-sidecar { color: #6ab26a; }
.rbac-mode__value--embedded-fallback { color: #d6a247; }
.rbac-mode__hint { font: 11px/1.4 var(--mono); color: var(--text-muted);
  word-break: break-all; }

.rbac-section {
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 1px solid var(--border-3); border-radius: 8px;
  background: var(--surface);
}
.rbac-section__head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; margin-bottom: 8px;
}
.rbac-section__head h3 { margin: 0; font: 600 15px/1.2 var(--sans); }
.rbac-section__hint { margin: 0 0 14px;
  font: 12px/1.55 var(--sans); color: var(--text-muted); }
.rbac-section__hint code { font: 11px var(--mono); background: rgba(0,0,0,0.2);
  padding: 1px 5px; border-radius: 3px; }
.rbac-section__meta { font: 11px/1 var(--mono); color: var(--text-muted); }
.rbac-section__meta code { color: var(--accent-hover); }
.rbac-edit-link { font: 12px/1 var(--sans); color: var(--accent-hover); }
.rbac-edit-link:hover { text-decoration: underline; }

.rbac-roles {
  display: flex; flex-direction: column; gap: 10px; margin-top: 4px;
}
.rbac-role {
  border: 1px solid var(--border-3);
  border-radius: 8px;
  background: var(--surface-down); /* recessed vs the outer section */
}
.rbac-role > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  font: 600 13px/1 var(--sans);
  list-style: none;
}
.rbac-role__body { padding: 0 14px 12px; }
.rbac-role--derived { border-style: dashed; }
.rbac-role > summary::-webkit-details-marker { display: none; }
.rbac-role > summary::before { content: "▸ "; }
.rbac-role[open] > summary::before { content: "▾ "; }
.rbac-role__name { text-transform: capitalize; }
.rbac-role__count {
  font: 600 11px/1 var(--mono);
  padding: 2px 8px;
  background: rgba(60,90,121,0.25); border-radius: 10px;
  color: var(--accent-hover);
}

.rbac-table {
  width: 100%; border-collapse: collapse;
  font: 13px/1.4 var(--sans);
}
.rbac-table th, .rbac-table td {
  text-align: left; padding: 7px 10px;
  border-bottom: 1px solid var(--border-3);
}
.rbac-table th {
  font: 600 11px/1 var(--sans);
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
}
.rbac-table code { font: 12px var(--mono); }
.rbac-table .rbac-cell-link {
  font: 12px var(--sans); color: var(--accent-hover);
}
.rbac-warn { color: #d6a247; font: 12px var(--mono); }
.rbac-empty { margin: 0; padding: 10px 0;
  font: 12px var(--sans); color: var(--text-muted); }

.rbac-policy > summary { cursor: pointer;
  font: 600 12px/1 var(--sans); color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
  list-style: none; padding: 6px 0;
}
.rbac-policy > summary::-webkit-details-marker { display: none; }
.rbac-policy > summary::before { content: "▸ "; }
.rbac-policy[open] > summary::before { content: "▾ "; }
.rbac-policy__source {
  margin: 8px 0 0; max-height: 480px; overflow: auto;
  padding: 14px 16px; background: #161D25;
  border: 1px solid var(--border-3); border-radius: 6px;
  font: 12px/1.55 var(--mono); color: var(--accent-hover);
}

.rbac-test { display: flex; flex-direction: column; gap: 10px; }
.rbac-test__field { display: flex; flex-direction: column; gap: 4px; }
.rbac-test__field span {
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted);
}
.rbac-test textarea {
  width: 100%; box-sizing: border-box;
  font: 12px/1.5 var(--mono);
  padding: 10px 12px;
  background: #161D25; color: var(--accent-hover);
  border: 1px solid var(--border-3); border-radius: 6px;
  resize: vertical;
}
.rbac-test__btn {
  align-self: flex-start;
  padding: 8px 18px;
  border-radius: 6px;
  background: var(--accent); color: var(--accent-on);
  border: 1px solid var(--accent);
  font: 600 13px/1 var(--sans);
  cursor: pointer;
}
.rbac-test__btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.rbac-test__result {
  margin: 12px 0 0;
  padding: 12px 14px;
  background: #161D25; color: var(--accent-hover);
  border: 1px solid var(--border-3); border-radius: 6px;
  font: 12px/1.55 var(--mono);
  white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow: auto;
}
.rbac-test__result--err {
  border-color: #c08a2a; background: rgba(192,138,42,0.12);
  color: #f3c66e;
}


/* =====================================================================
   Component refresh — forms, buttons, tables, panels, flash, empty.
   Appended at the end so legacy rules with higher specificity keep
   winning where the page hasn't migrated yet. New templates should
   reach for the .panel / .field-row / .btn / .flash vocabulary below.
   ===================================================================== */

/* ---------- form controls ---------- */
.admin-main input[type=text], .admin-main input[type=email],
.admin-main input[type=password], .admin-main input[type=number],
.admin-main input[type=date], .admin-main input[type=datetime-local],
.admin-main input[type=search], .admin-main input[type=url],
.admin-main select, .admin-main textarea,
.field-input, .field-select, .field-textarea {
  background: var(--bg);
  border: 1px solid var(--border-3);
  border-radius: 6px;
  padding: 8px 11px;
  color: var(--text);
  font: 13px/1.4 var(--sans);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-main input:hover, .admin-main select:hover, .admin-main textarea:hover {
  border-color: var(--border-4);
}
.admin-main input:focus, .admin-main select:focus, .admin-main textarea:focus,
.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px rgba(118, 145, 176, 0.18);
}
.admin-main input::placeholder, .admin-main textarea::placeholder,
.field-input::placeholder, .field-textarea::placeholder {
  color: var(--text-dim);
}
.admin-main select, .field-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23748D92' stroke-width='1.6'><path d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}

/* Inline control row: a labelled select + action button on one line, with a
   clear gap before the summary line below. */
.inline-form {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: 14px; margin: 4px 0 16px;
}
.inline-form > label {
  display: flex; flex-direction: column; gap: 6px;
  font: 600 10px/1 var(--sans); letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-dim);
}
.inline-form select, .inline-form .field-select {
  width: auto; min-width: 340px; max-width: 100%;
}
.inline-form + .muted { margin-top: 2px; }

/* ---------- field wrapper ---------- */
.field-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-row > label { display: flex; flex-direction: column; gap: 5px; }
.field-label,
.field-row > label > span:first-child {
  font: 600 11px/1.2 var(--sans);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-hint { font: 11px/1.4 var(--sans); color: var(--text-muted); margin-top: 4px; }
.field-row--inline { flex-direction: row; align-items: end; gap: 10px; flex-wrap: wrap; }

/* Compact horizontal form row — used on admin pages where a single
   field + submit lives in one line. */
.form-row {
  display: flex; gap: 10px; align-items: end; flex-wrap: wrap;
  margin: 8px 0 18px;
}
.form-row .field-row { margin-bottom: 0; flex: 1 1 180px; }

/* ---------- buttons ---------- */
.btn,
button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: var(--accent-on);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 16px;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
              transform 0.05s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn--sm { padding: 5px 10px; font-size: 11px; border-radius: 5px; }
.nowrap { white-space: nowrap; }

/* Status badges — /admin/status integrations + switches. */
.status-badge {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font: 600 10px/1.4 var(--sans); letter-spacing: 0.03em;
  border: 1px solid transparent; white-space: nowrap;
}
.status-badge--ok { color: var(--success); border-color: var(--success); }
.status-badge--degraded { color: #C99A3A; border-color: #C99A3A; }
.status-badge--off { color: var(--danger); border-color: var(--danger); }
.status-badge--not_configured { color: var(--text-dim); border-color: var(--border-4); }

/* /admin/status — 4-up counts grid + connection-test modal. */
.status-grid4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 6px;
}
.status-grid4 .stat {
  background: #161D25; border: 1px solid var(--border-3);
  border-radius: 8px; padding: 12px 14px;
}
@media (max-width: 760px) { .status-grid4 { grid-template-columns: repeat(2, 1fr); } }

.modal[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.modal__backdrop {
  position: absolute; inset: 0; z-index: 1; background: rgba(0, 0, 0, 0.6);
}
.modal__dialog {
  position: relative; z-index: 2;
  background: #1B232C; color: var(--text);
  border: 1px solid var(--border-3); border-radius: 10px;
  padding: 22px 24px; width: min(440px, 92vw);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.modal__title { margin: 0 0 10px; font-size: 16px; }
.modal__body { margin: 0 0 18px; font-size: 13px; line-height: 1.5; color: var(--text-soft); }
.modal__body.is-ok { color: var(--success); }
.modal__body.is-bad { color: var(--danger); }
.modal__actions { display: flex; justify-content: flex-end; }
.btn:hover, button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg);
}
.btn:active, button.primary:active { transform: translateY(1px); }
.btn:focus-visible, button.primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(118, 145, 176, 0.35);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-3);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-4); color: var(--text); }
.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(198, 117, 102, 0.4);
}
.btn--danger:hover {
  background: rgba(198, 117, 102, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}
.btn--sm { padding: 5px 11px; font-size: 11px; border-radius: 5px; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], button.primary[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---------- table polish ---------- */
.admin-table {
  border: 1px solid var(--border-2);
  border-radius: 8px;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;            /* consistent column widths across tables */
  width: 100%;
}
.admin-table th, .admin-table td { overflow: hidden; text-overflow: ellipsis; }
.admin-table thead th {
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
  font: 600 10px/1 var(--sans);
}
.admin-table tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--border-1);
  vertical-align: middle;
}
.admin-table tbody tr:first-child td { border-top: none; }
.admin-table tbody tr { transition: background 0.1s ease; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table code,
.rbac-table code,
.panel code {
  background: rgba(0,0,0,0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font: 12px var(--mono);
  color: var(--text-soft);
}

/* Right-aligned action cell — buttons + links in a row. Fixed width so
   action columns line up consistently across every admin table. */
.admin-table td.cell-actions,
.admin-table th.cell-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}
.admin-table td.cell-actions a,
.admin-table td.cell-actions form { display: inline-block; vertical-align: middle; }
.admin-table td.cell-actions a + form,
.admin-table td.cell-actions form + form { margin-left: 8px; }
/* Inline action forms (buttons rendered without the cell-actions wrapper)
   shouldn't stack — keep them on one row. */
.admin-table td > form { display: inline-block; }
.admin-table td > form + form { margin-left: 8px; }

/* ---------- panel / section ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 18px;
}
.panel + .panel { margin-top: 0; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.panel-head h3 { margin: 0; font: 600 15px/1.2 var(--sans); }
.panel-head__meta { font: 11px/1 var(--mono); color: var(--text-muted); }
.panel-hint {
  margin: 0 0 16px;
  font: 12px/1.55 var(--sans);
  color: var(--text-muted);
  max-width: 70ch;
}
.panel-hint code {
  background: rgba(0,0,0,0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font: 11px var(--mono);
  color: var(--text-soft);
}

/* ---------- flash messages ---------- */
.flash {
  padding: 11px 14px;
  border-radius: 7px;
  margin: 0 0 16px;
  font: 13px/1.45 var(--sans);
  border: 1px solid transparent;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.flash--ok {
  background: rgba(122, 163, 124, 0.12);
  border-color: rgba(122, 163, 124, 0.45);
  color: #cfe2cf;
}
.flash--err {
  background: rgba(198, 117, 102, 0.12);
  border-color: rgba(198, 117, 102, 0.45);
  color: #ecc4b9;
}
.flash--info {
  background: rgba(118, 145, 176, 0.12);
  border-color: rgba(118, 145, 176, 0.45);
  color: #c9d5e1;
}
.flash strong { color: inherit; }
.flash a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- empty state ---------- */
.empty-state {
  padding: 26px 22px;
  background: var(--surface);
  border: 1px dashed var(--border-3);
  border-radius: 10px;
  text-align: center;
  color: var(--text-muted);
  font: 13px/1.5 var(--sans);
}
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text-soft); }

/* ---------- admin sidebar polish ---------- */
/* Admin sidebar — mirrors the catalog filter sidebar (.filter-side):
   flush to the edge with a right border (no surface panel), uppercase
   section headers, compact pill rows, and a subtle active state. */
.admin-shell { display: grid; grid-template-columns: 216px 1fr; gap: 0; padding: 0; min-height: calc(100vh - 90px); }
.admin-side {
  border-right: 1px solid var(--border-2);
  padding: 24px 20px;
  align-self: stretch;
  display: flex; flex-direction: column; gap: 2px;
}
.admin-nav-group { display: flex; flex-direction: column; gap: 1px; }
.admin-side h4 {
  font: 600 10px/1 var(--sans);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 10px;
  margin: 20px 0 8px;
}
.admin-nav-group:first-child h4 { margin-top: 0; }
.admin-side a {
  display: flex; align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: 12px/1.4 var(--sans);
  color: var(--text-soft);
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.admin-side a:hover { background: var(--surface); color: var(--text); }
.admin-side a[aria-current="page"] {
  background: var(--surface-2);
  border-color: var(--border-4);
  color: var(--text);
  font-weight: 600;
}

/* ---------- admin-grid card refresh ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 18px;
  display: block;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.admin-card:hover {
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}
.admin-card h3 { font: 600 14px/1.2 var(--sans); margin-bottom: 6px; color: var(--text); }
.admin-card p { font: 12px/1.5 var(--sans); color: var(--text-muted); margin: 0; }

.panel-subhead {
  font: 600 11px/1.2 var(--sans);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 18px 0 8px;
}
.panel-subhead:first-child { margin-top: 0; }

.skill-draft-banner {
  margin: 0 auto 18px;
  max-width: 1080px;
  align-items: center;
}

/* Decision tester result panel — replaces the old <pre> JSON dump. */
.decision-result {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-3);
  background: var(--surface);
  margin-top: 14px;
}
.decision-result__badge {
  font: 600 11px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}
.decision-result__body { flex: 1; }
.decision-result__label {
  margin: 0 0 4px;
  font: 600 14px/1.4 var(--sans);
  color: var(--text);
}
.decision-result__reason {
  margin: 0;
  font: 11px/1.4 var(--mono);
  color: var(--text-muted);
}
.decision-result--allow {
  border-color: rgba(122, 163, 124, 0.5);
  background: rgba(122, 163, 124, 0.08);
}
.decision-result--allow .decision-result__badge {
  background: rgba(122, 163, 124, 0.22);
  color: #cfe2cf;
}
.decision-result--deny {
  border-color: rgba(198, 117, 102, 0.5);
  background: rgba(198, 117, 102, 0.08);
}
.decision-result--deny .decision-result__badge {
  background: rgba(198, 117, 102, 0.22);
  color: #ecc4b9;
}
.decision-result--err {
  border-color: rgba(214, 162, 71, 0.5);
  background: rgba(214, 162, 71, 0.08);
}
.decision-result--err .decision-result__badge {
  background: rgba(214, 162, 71, 0.22);
  color: #f3c66e;
}

/* Mode badge in the RBAC header — rebranded from opa-sidecar /
   embedded-fallback to live / builtin so the user-facing label
   doesn't leak engine internals. */
.rbac-mode__value--live    { color: #7AA37C; }
.rbac-mode__value--builtin { color: #D6A247; }

/* =====================================================================
   Create-shell — shared layout for /create-skill, /create-plugin,
   /create-knowledge-base etc. A centered column with header above a
   single .panel form.
   ===================================================================== */
.create-shell {
  max-width: 720px;
  margin: 28px auto;
  padding: 0 28px;
}
.create-head {
  margin-bottom: 18px;
}
.create-head h2 {
  margin: 0 0 6px;
  font: 600 22px/1.2 var(--sans);
}
.create-head .panel-hint {
  max-width: 60ch;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--border-2);
}

.bundle-layout {
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-3);
  border-radius: 6px;
  font-size: 12px;
}
.bundle-layout > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
}
.bundle-layout > summary:hover { color: var(--text); }
.bundle-layout pre {
  margin: 10px 0 0;
  font: 12px/1.6 var(--mono);
  color: var(--text-soft);
}
.bundle-layout code { background: transparent; padding: 0; }

/* =====================================================================
   Typography pass — readability on larger displays.
   Default baseline stays 13px so the dense skill-detail / browse views
   keep their character on laptops. At 1600px+ viewports we ratchet up
   to 14.5px and again at 1920px+ to 15.5px so 27"+ monitors don't make
   the catalog feel like fine print.
   ===================================================================== */
@media (min-width: 1600px) {
  html, body { font-size: 14.5px; line-height: 1.5; }
  .panel-head h3 { font-size: 16px; }
  .panel-hint { font-size: 13px; }
  .admin-table thead th { font-size: 11px; }
  .admin-table tbody td { font-size: 14px; }
  .btn { font-size: 13px; padding: 9px 18px; }
  .btn--sm { font-size: 12px; padding: 6px 12px; }
  .field-label,
  .field-row > label > span:first-child { font-size: 12px; }
  .admin-main input, .admin-main select, .admin-main textarea,
  .field-input, .field-select, .field-textarea { font-size: 14px; }
  .flash { font-size: 14px; }
  .empty-state { font-size: 14px; }
}

@media (min-width: 1920px) {
  html, body { font-size: 15.5px; line-height: 1.5; }
  .create-shell { max-width: 820px; }
  .panel-head h3 { font-size: 17px; }
  .admin-table tbody td { font-size: 15px; }
  .btn { font-size: 14px; padding: 10px 20px; }
  .admin-main input, .admin-main select, .admin-main textarea,
  .field-input, .field-select, .field-textarea { font-size: 15px; }
}

/* =====================================================================
   Browse page header — sits above the .browse-layout grid so the
   title + lede + action button live in their own band instead of
   competing with the filter sidebar or floating inside the results
   column. Used by skills/mcp/plugin/kb browse pages.
   ===================================================================== */
.browse-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px 10px;
}
.browse-page-head__title {
  flex: 1 1 auto;
  min-width: 0;
}
.browse-page-head__title h1 {
  margin: 0 0 4px;
  font: 600 22px/1.2 var(--sans);
  color: var(--text);
}
.browse-page-head__lede {
  margin: 0;
  color: var(--text-muted);
  font: 13px/1.55 var(--sans);
  max-width: 70ch;
}
.browse-page-head__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
@media (min-width: 1600px) {
  .browse-page-head__title h1 { font-size: 24px; }
  .browse-page-head__lede { font-size: 14px; }
}

/* Make the existing kb-shell/kb-head use the same vocabulary so KB
   list/detail pages stay in lockstep visually. */
.kb-head { margin-bottom: 14px; }
.kb-head h1 { font: 600 22px/1.2 var(--sans); }
@media (min-width: 1600px) {
  .kb-head h1 { font-size: 24px; }
}

/* Tighten spacing inside .panel — the form-row at the top of a panel
   doubled up the panel padding with the field-row margin. */
.panel > .form-row:first-child { margin-top: 0; }
.panel > .form-row:last-child { margin-bottom: 0; }
.panel > h4.panel-subhead:first-child { margin-top: 0; }
.panel > .admin-table:first-child,
.panel > .empty-state:first-child { margin-top: 4px; }

/* Page-level header strip used by admin pages (e.g. Allowlist, Teams)
   that put a panel-head outside any .panel for the page title. The
   inline style="margin-bottom:18px" usage across templates worked but
   wasn't consistent — promote it to a real class so spacing matches. */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head h2 {
  margin: 0 0 4px;
  font: 600 22px/1.2 var(--sans);
}
.page-head .panel-hint {
  margin: 0;
  max-width: 70ch;
}
.page-head__actions { display: flex; gap: 10px; flex-shrink: 0; }
@media (min-width: 1600px) {
  .page-head h2 { font-size: 24px; }
}

/* =====================================================================
   Impersonation banner — shown when an admin is "viewing as" another
   user. Yellow/amber color so it's impossible to miss; pinned to the
   top so the admin can stop impersonation from any page.
   ===================================================================== */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  background: rgba(214, 162, 71, 0.18);
  border-bottom: 1px solid rgba(214, 162, 71, 0.55);
  color: #f3c66e;
  font: 13px/1.4 var(--sans);
}
.impersonation-banner__copy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.impersonation-banner__copy strong { color: #f3c66e; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.impersonation-banner__copy code {
  background: rgba(0,0,0,0.25); padding: 2px 6px; border-radius: 4px;
  font: 12px var(--mono); color: #f7d28d;
}
.impersonation-banner__sep { color: rgba(243, 198, 110, 0.5); }
.impersonation-banner__action .btn {
  background: #f3c66e; border-color: #f3c66e; color: var(--bg);
}
.impersonation-banner__action .btn:hover {
  background: #ffd684; border-color: #ffd684; color: var(--bg);
}

/* Edit page: replace-skill-from-zip drop zone. */
.replace-panel { margin-top: 28px; padding: 18px 20px;
  border: 1px solid var(--border-3); border-radius: 8px; background: var(--surface); }
.replace-panel h2 { font: 600 15px/1.2 var(--sans); margin: 0 0 6px; }
.replace-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
/* Reuses the shared .dropzone / .dropzone.dragover styling + the generic
   .dropzone drag-drop handler in app.js — no bespoke dropzone rules here. */
.replace-form input[type=file] { display: none; }
.replace-form .action-btn { align-self: flex-start; }

/* Bundled (non-editable) files list — edit + detail pages. */
.bundled-files { margin-top: 22px; }
.bundled-files h3 { font: 600 14px/1.2 var(--sans); margin: 0 0 4px; }
.file-list { list-style: none; margin: 10px 0 0; padding: 0;
  border: 1px solid var(--border-3); border-radius: 8px; overflow: hidden; }
.file-list__row { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 9px 14px; border-top: 1px solid var(--border-3); }
.file-list__row:first-child { border-top: none; }
.file-list__name { font: 13px/1.3 var(--sans); color: var(--text); word-break: break-all; }
.file-list__meta { font: 11px/1 var(--mono); color: var(--text-muted); white-space: nowrap; }

/* Long description clamp on the detail page (≈800px, expandable). */
.lede-clamp { max-height: 800px; overflow: hidden; position: relative; }
.lede-clamp.is-expanded { max-height: none; }
.lede-clamp:not(.is-expanded).is-clamped::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px;
  background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }
.clamp-toggle { margin-top: 8px; background: none; border: none; padding: 0;
  cursor: pointer; font: 600 13px/1 var(--sans); color: var(--accent-hover); }
.clamp-toggle:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ */
/* Profile page: usage visuals, My Skills list, Observer panel.        */
/* ------------------------------------------------------------------ */
.profile-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin: 0 0 22px; }
.profile-name { margin: 0; font: 600 22px/1.2 var(--sans); letter-spacing: -0.02em; }
/* Constrained key/value list for profile/detail pages — reusable. */
.detail-defs { max-width: 560px; margin: 0; }
.detail-defs__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 11px 2px;
  border-bottom: 1px solid var(--border-1);
}
.detail-defs__row:last-child { border-bottom: none; }
.detail-defs dt {
  margin: 0; font: 600 10px/1.4 var(--sans);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim);
}
.detail-defs dd { margin: 0; font-size: 13px; color: var(--text-soft); }
.detail-defs dd.is-empty { color: var(--text-dim); font-style: italic; }
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-on);
  font-size: 24px; font-weight: 700;
}
.profile-email { margin: 0; font: 600 22px/1.2 var(--sans); letter-spacing: -0.02em; }
.profile-role {
  display: inline-block; margin-top: 4px; padding: 2px 10px;
  border-radius: 6px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border-4);
  color: var(--text-muted);
}
.profile-section {
  margin: 0 0 18px; padding: 22px 24px;
  background: var(--surface); border: 1px solid var(--border-4);
  border-radius: 10px;
}
.profile-section h2 { margin: 0 0 14px; font-size: 16px; }
.profile-subhead { margin: 18px 0 8px; font-size: 13.5px; color: var(--text-muted); }
.profile-hint { font-size: 13px; margin-top: 12px; }

/* THE one outline treatment for rows/tiles on the user-home pages —
   copied from the Salesforce status row (.observer-status family):
   1px solid var(--border-4), radius 8, 12/14 padding. Usage tiles,
   detail rows, skill rows, and the status rows all share it. */
.profile-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border-4); border-radius: 8px;
}
.profile-card-list { display: flex; flex-direction: column; gap: 10px; }
/* "Coming soon" empty state for My Usage (analytics not yet configured).
   Overrides the row layout of .profile-card to a left-aligned column. */
.usage-soon {
  flex-direction: column; align-items: flex-start;
  gap: 10px; padding: 22px 24px;
}
.usage-soon__title { margin: 0; font-size: 1.15rem; }
.usage-soon__list { margin: 0; padding-left: 18px; line-height: 1.6; }
.usage-soon__list li { margin: 2px 0; }

/* ── My Usage dashboard ───────────────────────────────────────────────────
   Panels use the recessed field-edit surface (#161D25, same as .md-textarea).
   Charts fill the full panel width; titles are small caption labels on top. */
.usage-panel {
  display: flex; flex-direction: column;
  background: #161D25; border: 1px solid var(--border-3); border-radius: 10px;
  padding: 14px 16px; margin: 0 0 14px;
}
.usage-panel__title {
  font: 600 10px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 12px;
}
/* Title row with right-aligned range pills (top tokens chart). */
.usage-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.usage-panel__head .usage-panel__title { margin-bottom: 0; }
.usage-range {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border-3);
  border-radius: 7px;
}
.usage-range__pill {
  font: 600 10px/1 var(--sans); letter-spacing: 0.04em;
  color: var(--text-dim); background: transparent; border: 0;
  border-radius: 5px; padding: 6px 12px; cursor: pointer;
  text-decoration: none; display: inline-block;
  transition: background .15s ease, color .15s ease;
}
.usage-range__pill:hover { color: var(--text-soft); }
.usage-range__pill.is-active { background: #EAEDEB; color: #161D25; }

/* Auto-fitting card row — used by the Office/Cowork/Design surface panels. */
.usage-row--auto {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; align-items: start; margin-bottom: 14px;
}
.usage-row--auto > .usage-panel { margin-bottom: 0; }

/* Small info bubble (hover for a tooltip), e.g. beside Current Spend. */
.info-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 6px; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--border-4);
  font: 700 9px/1 var(--serif, Georgia), serif; font-style: italic;
  color: var(--text-muted); cursor: help; user-select: none;
}
.info-dot:hover { color: var(--text); border-color: var(--text-muted); }
.usage-chart { position: relative; width: 100%; height: 240px; }
.usage-chart--tall { height: 320px; }

.usage-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  align-items: stretch; margin-bottom: 14px;
}
.usage-row > .usage-panel { margin-bottom: 0; }
/* paired breakdown stretches to its neighbour's (chart) height, rows spread */
.usage-row .usage-breakdown { flex: 1 1 auto; justify-content: space-around; }
.usage-row .usage-breakdown--legend { flex: 0 0 auto; justify-content: flex-start; }

/* stat tiles */
.usage-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px;
}
.usage-tiles--stat { margin-bottom: 14px; }
.usage-stat {
  display: flex; flex-direction: column; gap: 5px;
  background: #161D25; border: 1px solid var(--border-3); border-radius: 9px;
  padding: 13px 15px;
}
.usage-stat__num { font: 800 19px/1 var(--sans); letter-spacing: -0.01em; color: var(--text); }
.usage-stat__lab { font: 600 9px/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.usage-stat--sm .usage-stat__num { font-size: 16px; }

/* breakdown "lines": name + value with a thin share bar underneath */
.usage-breakdown { display: flex; flex-direction: column; }
.usage-breakdown__row {
  position: relative; display: flex; align-items: baseline; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--border-1);
}
.usage-breakdown__row:last-child { border-bottom: none; }
.usage-breakdown__name { flex: 1 1 auto; font-size: 12.5px; color: var(--text-soft); min-width: 0; }
.usage-breakdown__sub { font: 10px/1 var(--mono); color: var(--text-dim); }
.usage-breakdown__sub-inline { font: 10.5px/1 var(--mono); color: var(--text-dim); white-space: nowrap; }
.usage-breakdown__pct { font: 700 13px/1 var(--sans); color: var(--text); white-space: nowrap; }
.usage-breakdown__val { font: 600 12px/1 var(--mono); color: var(--text); white-space: nowrap; }
.usage-panel__sub { margin: -8px 0 12px; font-size: 11px; line-height: 1.45; color: var(--text-muted); }
.usage-breakdown__bar {
  position: absolute; left: 0; bottom: 0; height: 6px;
  background: var(--accent); border-radius: 3px; opacity: 0.8;
}
.usage-breakdown--legend .usage-breakdown__row { padding: 6px 2px; }
.usage-swatch { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; align-self: center; }

/* model table */
.usage-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.usage-table th {
  text-align: left; font: 600 9px/1.2 var(--sans); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0 10px 8px; border-bottom: 1px solid var(--border-3);
}
.usage-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-1); color: var(--text-soft); }
.usage-table tr:last-child td { border-bottom: none; }
.usage-table td:first-child { color: var(--text); }
.usage-table .r, .usage-table td.r { text-align: right; font-family: var(--mono); white-space: nowrap; }

/* token composition stacked bar */
.usage-compbar {
  display: flex; width: 100%; height: 14px; border-radius: 7px; overflow: hidden;
  background: var(--surface-2); margin-bottom: 12px;
}
.usage-compbar__seg { height: 100%; }
.usage-note { margin: 10px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.usage-panel--note p { margin: 0; font-size: 12.5px; line-height: 1.55; }
.usage-foot { font-size: 12px; margin-top: 12px; }
.usage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 22px;
}
.usage-head h2, .usage-head__title { margin: 0; font-size: 27px; letter-spacing: -0.02em; }
.usage-head__interval {
  font: 600 9.5px/1 var(--sans); letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border-3); border-radius: 6px;
  padding: 5px 11px; white-space: nowrap;
}

/* Current-spend line beside the profile name (right-justified). */
.profile-spend {
  margin-left: auto; align-self: center;
  font-size: 15px; font-weight: 500; color: var(--text-soft); text-align: right;
}

/* My Account → Settings rows (one card per setting). */
.settings-list { display: flex; flex-direction: column; gap: 14px; max-width: 760px; margin-top: 6px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  background: #161D25; border: 1px solid var(--border-3);
  border-radius: 8px; padding: 18px 20px;
}
.settings-row__text { flex: 1 1 auto; }
.settings-row__title { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.settings-row__text p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-muted); max-width: 62ch; }
.settings-row__control { flex: 0 0 auto; margin: 0; align-self: center; }
@media (max-width: 640px) {
  .settings-row { flex-direction: column; align-items: flex-start; gap: 14px; }
}

@media (max-width: 820px) { .usage-row { grid-template-columns: 1fr; } }
.profile-card--stat {
  flex-direction: column; align-items: stretch;
  justify-content: flex-start; gap: 2px;
}

/* Stat cards — tiles are .profile-card .profile-card--stat now */
.profile-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.profile-stat__num { font-size: 24px; font-weight: 700; }
.profile-stat__label { font-size: 12px; color: var(--text-muted); }

/* 30-day activity bar chart (pure CSS) */
.profile-chart {
  display: flex; align-items: flex-end; gap: 3px;
  height: 84px; padding: 6px 2px 0;
  border-bottom: 1px solid var(--border-4);
}
.profile-chart__bar {
  flex: 1; min-width: 4px; border-radius: 2px 2px 0 0;
  background: var(--border-4);
}
.profile-chart__bar.has-activity { background: var(--accent); }
.profile-chart__caption { font-size: 12px; margin-top: 6px; }

/* Most-used skills horizontal bars */
.profile-top-skills { list-style: none; margin: 0; padding: 0; }
.profile-top-skills li {
  display: grid; grid-template-columns: 200px 1fr 36px;
  align-items: center; gap: 10px; padding: 4px 0; font-size: 13.5px;
}
.profile-top-skills__track {
  height: 8px; border-radius: 4px; background: var(--border-4);
  overflow: hidden;
}
.profile-top-skills__fill {
  display: block; height: 100%; background: var(--accent); border-radius: 4px;
}
.profile-top-skills__n { text-align: right; color: var(--text-muted); font-size: 12.5px; }

/* My Skills list — rows are .profile-card now; ul is a .profile-card-list */
.profile-skills { list-style: none; margin: 0; padding: 0; }
.profile-skill-row__name { font-weight: 500; flex: 0 0 auto; }
.profile-skill-row__team { color: var(--text-muted); font-size: 12.5px; flex: 1; }
.profile-skill-row__remove {
  padding: 3px 10px; font-size: 12px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border-4);
  color: var(--text-muted); cursor: pointer;
}
.profile-skill-row__remove:hover { color: #c0392b; border-color: #c0392b; }

/* Observer state flags */
.profile-observer-state { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.profile-flag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 6px;
  font: 600 12.5px/1 var(--sans);
  border: 1px solid var(--border-3); color: var(--text-soft);
  background: var(--surface-2);
}
.profile-flag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); flex: 0 0 auto;
}
.profile-flag.on { border-color: var(--accent); color: var(--text); }
.profile-flag.on::before { background: var(--accent); }

/* Profile observer panel: phase chip + clear on/off status row */
.profile-observer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.profile-phase {
  flex: 0 0 auto; padding: 3px 12px; border-radius: 6px;
  font-size: 12px; color: var(--text-muted);
  border: 1px solid var(--border-4); background: var(--surface);
  white-space: nowrap;
}
/* Status rows take the shared .profile-card outline; .observer-status
   keeps only its rhythm + on/off state extras (dot, accent border). */
.observer-status { margin: 14px 0 10px; }
.observer-status__state { display: flex; align-items: center; gap: 10px; }
.observer-status__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-dim);
}
.observer-status.is-on { border-color: var(--accent); }
.observer-status.is-on .observer-status__dot { background: var(--accent); }
.profile-observer-form { margin: 0; }

/* People & Roles: add-user form + per-row role select + trash */
.rbac-add-user {
  display: flex; gap: 8px; align-items: center;
  margin: 0 0 14px;
}
.rbac-add-user__email { flex: 0 1 320px; }
.rbac-role-form { margin: 0; }
.rbac-role-form select { font-size: 12.5px; padding: 3px 6px; }
.rbac-trash {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  background: transparent; border: 1px solid var(--border-4);
  color: var(--text-muted); cursor: pointer;
  transition: all 0.18s ease;
}
.rbac-trash:hover { color: #c0392b; border-color: #c0392b; }

/* Install page: "already in Claude" panel + screenshot */
.install-primary__already {
  margin-bottom: 22px; padding: 16px 18px;
  border: 1px solid var(--accent); border-radius: 10px;
  background: var(--surface);
}
.install-primary__already h2 { margin: 0 0 8px; font-size: 17px; }
.install-primary__shot {
  display: block; max-width: 560px; width: 100%;
  margin-top: 12px; border-radius: 8px;
  border: 1px solid var(--border-4);
}

/* People & Roles: full-name cell; profile header email line */
.rbac-name { display: block; font-weight: 500; }
.rbac-name__meta { display: block; font-size: 11.5px; color: var(--text-dim); }
.profile-head__email { display: block; font-size: 13px; margin: 2px 0 4px; }

/* STATUS draft/published segmented toggle (skill + plugin rails).
   Fills the rail width; each side takes exactly half. */
.status-toggle {
  display: flex; width: 100%; margin: 0;
  border: 1px solid var(--border-3); border-radius: 8px;
  overflow: hidden;
}
.status-toggle__opt {
  flex: 1 1 50%; padding: 7px 0; font: 600 12.5px var(--sans);
  text-align: center;
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.status-toggle__opt + .status-toggle__opt { border-left: 1px solid var(--border-3); }
.status-toggle__opt:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,0.04); }
.status-toggle__opt.is-active {
  background: var(--accent); color: var(--accent-on); cursor: default;
}

/* Small hint line under rail headings (e.g. the Advanced section) */
.rail-hint { margin: -2px 0 8px; font-size: 12px; color: var(--text-muted); }

/* ── Reusable form controls: toggle switch + segmented radio ──────────────
   Replace the input-hidden .select-box pattern for binary on/off and
   either/or choices, where a visible control reads far clearer. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch > input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.switch__track {
  position: relative; flex: 0 0 auto; width: 40px; height: 22px;
  background: var(--surface-2); border: 1px solid var(--border-3);
  border-radius: 7px; transition: background .15s ease, border-color .15s ease;
}
.switch__thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-muted);
  transition: transform .15s ease, background .15s ease;
}
.switch__text { font: 12.5px var(--sans); color: var(--text-soft); }

/* Switch as a submit button (gateway on/off on the article detail page) or a
   static state indicator — shares the track/thumb visuals, "on" via .is-on. */
.switch-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: none; border: 0; padding: 0; font: inherit; cursor: default;
}
button.switch-btn { cursor: pointer; }
.switch-btn__label {
  font: 600 12px/1 var(--sans); letter-spacing: 0.02em; color: var(--text-muted);
}
.switch-btn.is-on .switch-btn__label { color: var(--text); }

/* On-state for both the checkbox switch and the .is-on button/static switch. */
.switch > input:checked + .switch__track,
.switch-btn.is-on .switch__track { background: var(--accent); border-color: var(--accent); }
.switch > input:checked + .switch__track .switch__thumb,
.switch-btn.is-on .switch__track .switch__thumb {
  transform: translateX(16px); background: var(--accent-on);
}
.switch > input:focus-visible + .switch__track,
button.switch-btn:focus-visible .switch__track {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Radio cards — mutually-exclusive modes that each carry a short description.
   Clearer and more deliberate than a segmented toggle for settings choices. */
.radio-cards { display: flex; gap: 10px; max-width: 560px; }
.radio-card {
  position: relative; flex: 1 1 0;
  display: flex; flex-direction: column; gap: 5px;
  padding: 12px 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-3);
  border-radius: 9px;
  transition: border-color .15s ease, background .15s ease;
}
.radio-card > input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.radio-card:hover { border-color: var(--border-4); }
.radio-card__title {
  position: relative; padding-left: 24px;
  font: 600 13px/1.2 var(--sans); color: var(--text-soft);
}
.radio-card__title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; border-radius: 50%;
  border: 1.5px solid var(--border-4); background: transparent;
  transition: border-color .15s ease, background .15s ease;
}
.radio-card__desc { padding-left: 24px; font: 12px/1.4 var(--sans); color: var(--text-dim); }
.radio-card:has(input:checked) { border-color: var(--accent); }
.radio-card:has(input:checked) .radio-card__title { color: var(--text); }
.radio-card:has(input:checked) .radio-card__title::before {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 3.5px, transparent 4px);
}
.radio-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── KB article AI Gateway tab (KB UX + Heron Task 1) ─────────────────────
   Compact definition rows replace the old .profile-card mega-grid. Keys use
   the small-caps label recipe shared with .ref-group-label / .filter-side
   h4; values stay at the site's 13px body scale. */
.gw-rows {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
  margin-top: 18px;
}
.gw-key {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim);
  padding-top: 4px;
}
.gw-val { font-size: 13px; color: var(--text-soft); line-height: 1.55; min-width: 0; }
.gw-val .bubble { margin: 0 4px 4px 0; }
.gw-status-text strong { color: var(--text); }
.gw-empty { color: var(--text-muted); }
.gw-toggle-form { display: inline-block; margin-right: 8px; vertical-align: baseline; }
/* Read-well block for the injected guidance — same recessed surface +
   accent edge the .md-frontmatter card uses. */
.gw-digest {
  background: #161D25;
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 10px 14px;
  font-size: 12.5px; line-height: 1.6; color: var(--text);
}

/* ON/OFF state pill — single state control; the title attribute carries the
   effect text ("ON — guidance is injected… Click to turn off."). Rendered as
   a <button> for architects (clickable toggle) and a <span> for everyone
   else (state display only). */
.onoff-pill {
  display: inline-flex; align-items: center;
  font: 600 10px var(--mono); letter-spacing: 0.12em;
  padding: 3px 12px; border-radius: 6px;
  border: 1px solid var(--border-3);
  background: var(--surface-down);
  color: var(--text-dim);
}
.onoff-pill.is-on { color: var(--success); border-color: rgba(122, 163, 124, 0.5); }
button.onoff-pill { cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease; }
button.onoff-pill:hover { border-color: var(--border-4); color: var(--text); }

/* Salesforce-gated AI Gateway edit fieldset (KB UX + Heron Task 2).
   The fieldset is a transparent wrapper (no chrome of its own); when the
   Salesforce application is unchecked it goes disabled — native form
   controls stop submitting and the whole block dims. pointer-events
   covers the non-form controls inside (details/summary picker). */
.gw-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.gw-fieldset:disabled { opacity: 0.45; pointer-events: none; }
.gw-app-notice { margin: 2px 0 18px; font-size: 12px; }

/* ── Heron configuration (KB UX + Heron Task 4) ───────────────────────────
   The active directive renders as markdown inside a recessed, scrollable
   read-well — same surface recipe as .gw-digest, capped so the page stays
   scannable. The propose form reuses the .field recipe from the editors. */
.heron-directive {
  background: #161D25;
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 14px 18px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 12.5px;
}
/* Override .admin-form's inline flex — this is a full vertical form. */
.heron-propose { display: block; max-width: 760px; }
.heron-propose .field { margin-bottom: 16px; }
.heron-propose .field label { display: block; margin-bottom: 6px; font-size: 12px; }
.heron-propose .hint { font-size: 11px; color: var(--text-dim); font-weight: normal; }
.heron-propose input[type="text"] { max-width: 200px; }
.heron-propose .md-textarea { width: 100%; min-height: 320px; box-sizing: border-box; }
.heron-propose button { margin-top: 4px; }

/* Dark scrollbars everywhere — kills the OS-default white scrollbar on
   textareas, menus, and scroll panes. */
* { scrollbar-width: thin; scrollbar-color: #3F4C58 transparent; }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #3F4C58; border-radius: 6px;
  border: 3px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: #51606E; background-clip: padding-box; }
