  /* Gallery view — every published file/link and live registered app, across every project */
  #gallery-view { flex: 1; overflow-y: auto; padding: 20px 28px; }
  #gallery-view h2 { font-size: 15px; margin: 0 0 4px; }
  #gallery-view .sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 18px; }

  @keyframes gallery-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* HUD readout strip — a telemetry-style summary row above the tabs.
     Each stat doubles as a shortcut into its tab (holographic theming
     tied to actual function, not just decoration), and fills in with a
     live count as its section finishes loading (starts at "–"). */
  .gallery-hud {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1px;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--border);
    border: 1px solid var(--border);
  }
  .hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 14px 10px;
    background: linear-gradient(160deg, var(--panel), var(--panel-2));
    cursor: pointer;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: background 0.2s ease;
  }
  .hud-stat::before {
    content: "";
    position: absolute; inset: -20% 0;
    background: linear-gradient(180deg, transparent, rgba(85,124,104,0.08), transparent);
    transform: translateY(-100%);
    animation: hud-scan 5s linear infinite;
    animation-delay: calc(var(--hud-i, 0) * -0.9s);
    pointer-events: none;
    z-index: -1;
  }
  .hud-stat:nth-child(1) { --hud-i: 1; }
  .hud-stat:nth-child(2) { --hud-i: 2; }
  .hud-stat:nth-child(3) { --hud-i: 3; }
  .hud-stat:nth-child(4) { --hud-i: 4; }
  .hud-stat:nth-child(5) { --hud-i: 5; }
  @keyframes hud-scan {
    to { transform: translateY(100%); }
  }
  .hud-stat:hover { background: linear-gradient(160deg, var(--panel-2), var(--panel)); }
  .hud-stat .hud-icon .icon-svg {
    width: 18px; height: 18px;
    color: var(--accent-2);
    filter: drop-shadow(0 0 6px rgba(62,90,76,0.55));
  }
  .hud-stat .hud-value {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.1;
    background: linear-gradient(90deg, var(--accent), var(--accent-2) 55%, #E4DDCE);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .hud-stat .hud-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    text-align: center;
  }

  /* Tabs — sections used to stack as one long scrolling page; now only
     the active section renders, same tab language as the project
     toolbar and Settings tabs (holo underline lives in holo-theme.css). */
  .gallery-tabs {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
  }
  .gallery-tab-btn {
    display: flex; align-items: center; gap: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    border-radius: 8px 8px 0 0;
    padding: 9px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .gallery-tab-btn .icon-svg { width: 14px; height: 14px; }
  .gallery-tab-btn:hover { color: var(--text); }

  .gallery-panel { display: none; animation: gallery-fade-up 0.3s ease both; }
  .gallery-panel.active { display: block; }
  .gallery-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
  .gallery-panel-header .sub { margin-bottom: 0; flex: 1; }
  /* Fill/shimmer/hover/typography come from holo-theme.css's shared
     primary-button treatment (same selector list as #main-toolbar
     button.primary, #composer button, etc.) so this reads as the same
     control as every other primary CTA in the app. */
  .gallery-panel-header button.primary { border: none; color: #070605; font-weight: 700; flex-shrink: 0; }

  .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

  .gallery-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    background: linear-gradient(160deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 14px 16px;
    overflow: hidden;
    animation: gallery-fade-up 0.35s ease both;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
  }
  /* stagger the entrance across the first couple rows of any grid size */
  .gallery-grid .gallery-card:nth-child(1) { animation-delay: 0ms; }
  .gallery-grid .gallery-card:nth-child(2) { animation-delay: 30ms; }
  .gallery-grid .gallery-card:nth-child(3) { animation-delay: 60ms; }
  .gallery-grid .gallery-card:nth-child(4) { animation-delay: 90ms; }
  .gallery-grid .gallery-card:nth-child(5) { animation-delay: 120ms; }
  .gallery-grid .gallery-card:nth-child(6) { animation-delay: 150ms; }
  .gallery-grid .gallery-card:nth-child(n+7) { animation-delay: 170ms; }

  .gallery-card::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--holo);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    animation: holo-spin 6s linear infinite;
  }
  .gallery-card:hover {
    transform: translateY(-3px);
    border-color: transparent;
    box-shadow: 0 12px 28px -14px rgba(0,0,0,0.55), 0 0 0 1px rgba(85,124,104,0.15);
  }
  .gallery-card:hover::before { opacity: 1; }

  .gallery-card .gc-top { display: flex; align-items: center; gap: 9px; }
  .gallery-card .gc-icon {
    font-size: 15px; flex-shrink: 0;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: rgba(85,124,104,0.1);
    transition: transform 0.2s ease, background 0.2s ease;
  }
  .gallery-card:hover .gc-icon { transform: scale(1.08) rotate(-4deg); background: rgba(85,124,104,0.18); }
  .gallery-card .gc-title { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
  .gallery-card .gc-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .gallery-card .gc-status.up { background: var(--green); box-shadow: 0 0 6px var(--green); animation: sudo-glow 2.4s ease-in-out infinite; }
  .gallery-card .gc-status.down { background: var(--text-dim); }
  .gallery-card .gc-link { font-size: 11.5px; font-family: var(--mono); color: var(--accent); text-decoration: none; word-break: break-all; transition: color 0.15s ease; }
  .gallery-card .gc-link:hover { color: var(--accent-2); text-decoration: underline; }
  .gallery-card .gc-meta { font-size: 11px; color: var(--text-dim); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gallery-card .gc-desc { font-size: 12px; color: var(--text); line-height: 1.4; }
  .gallery-card .gc-desc-strong { font-weight: 700; }

  /* Capability docs (endpoint/usage) — collapsed by default so the card
     reads as icon + bold title/description, not a wall of technical
     reference text; the "Docs" action reveals them in place. */
  .gallery-card .gc-docs {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.25s ease, opacity 0.2s ease;
  }
  .gallery-card .gc-docs > * { min-height: 0; overflow: hidden; }
  .gallery-card.docs-open .gc-docs { grid-template-rows: 1fr; opacity: 1; }
  .gallery-card .gc-actions .docs-toggle-btn { display: flex; align-items: center; gap: 5px; }
  .gallery-card .gc-actions .docs-toggle-btn .icon-svg { width: 12px; height: 12px; }
  .gallery-card.docs-open .gc-actions .docs-toggle-btn { color: var(--accent-2); border-color: var(--accent-2); }
  .gallery-card .gc-usage {
    font-size: 11px;
    font-family: var(--mono);
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 100px;
    overflow-y: auto;
    margin: 0;
  }
  .gallery-card .gc-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }
  .gallery-card .gc-actions button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  }
  .gallery-card .gc-actions button:hover { color: var(--text); border-color: var(--accent-2); background: rgba(85,124,104,0.08); box-shadow: 0 0 12px -4px rgba(62,90,76,0.4); }
  .gallery-card .gc-actions .revoke-btn:hover, .gallery-card .gc-actions .remove-btn:hover { color: var(--red); border-color: var(--red); background: rgba(255,107,107,0.1); box-shadow: 0 0 12px -4px rgba(255,107,107,0.4); }

  .gallery-empty {
    color: var(--text-dim); font-size: 13px;
    border: 1px dashed var(--border); border-radius: 12px;
    padding: 22px; text-align: center;
    animation: gallery-fade-up 0.3s ease both;
  }

  /* Skeleton loading state — shown while a section's data is in flight,
     so the layout doesn't jump from a bare "Loading…" line to a full grid. */
  @keyframes gallery-shimmer {
    from { background-position: -200px 0; }
    to { background-position: 200px 0; }
  }
  .gallery-skeleton-card {
    height: 96px;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 40%, var(--panel) 80%);
    background-size: 400px 100%;
    animation: gallery-shimmer 1.3s linear infinite;
  }

  .cap-request-filter { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
  .cap-request-status-badge {
    cursor: pointer; border: 1px solid transparent; opacity: 0.45;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  }
  .cap-request-status-badge:hover { opacity: 0.8; transform: translateY(-1px); }
  .cap-request-status-badge.active { opacity: 1; border-color: currentColor; box-shadow: 0 0 10px -3px currentColor; }
  .cap-request-status-badge.pending { background: rgba(245,184,79,0.15); color: var(--amber); }
  .cap-request-status-badge.approved { background: rgba(62,207,142,0.15); color: var(--green); }
  .cap-request-status-badge.rejected { background: rgba(255,107,107,0.15); color: var(--red); }
  .cap-request-kind-badge.new { background: rgba(154,209,201,0.15); color: #9B958A; }
  .cap-request-kind-badge.modify { background: rgba(245,184,79,0.15); color: var(--amber); }
  .cap-request-scope-badge { background: rgba(154,154,209,0.15); color: #9B958A; }
  .cap-request-sudo-badge { background: rgba(255,107,107,0.15); color: var(--red); }
  .cap-request-sudo-badge .icon-svg { width: 11px; height: 11px; color: var(--red); }

  .cap-request-implication {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--text-dim);
    background: rgba(255,255,255,0.03);
    border-left: 2px solid var(--accent-2);
    padding: 6px 8px;
    border-radius: 4px;
  }
  .cap-request-implication .icon-svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 1px; color: var(--accent-2); }
  .cap-request-implication.sudo { border-left-color: var(--red); color: var(--text); }
  .cap-request-implication.sudo .icon-svg { color: var(--red); }
  .cap-request-implication.decided { border-left-color: var(--green); }
  .cap-request-implication.decided .icon-svg { color: var(--green); }
  .cap-request-implication.rejected-note { border-left-color: var(--text-dim); }
  .cap-request-implication.rejected-note .icon-svg { color: var(--text-dim); }
  .cap-request-timestamp { font-size: 10.5px; color: var(--text-dim); font-style: italic; }

  /* Repository tab — category filter chips, per-card category badge, tags */
  .repo-filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
  .repo-category-filter { display: flex; gap: 6px; flex-wrap: wrap; }
  .repo-category-chip {
    cursor: pointer; font-size: 11px; font-weight: 600; text-transform: capitalize;
    padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border);
    color: var(--text-dim); background: var(--panel-2);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  }
  .repo-category-chip:hover { color: var(--text); }
  .repo-category-chip.active { color: var(--accent-2); border-color: var(--accent-2); background: rgba(85,124,104,0.1); }
  #repo-search-input {
    flex: 1; min-width: 180px; max-width: 320px;
    background: var(--panel-2);
    border-radius: 20px; padding: 6px 12px; font-size: 12px;
  }
  .repo-category-badge {
    color: var(--accent-2); background: rgba(85,124,104,0.12);
    margin-right: 6px;
  }
  .repo-tags { display: flex; gap: 5px; flex-wrap: wrap; }
  .repo-tag-badge {
    color: var(--text-dim); background: var(--panel-2);
    border: 1px solid var(--border);
  }

  #repository-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6,7,10,0.72);
    align-items: center;
    justify-content: center;
    z-index: 100;
  }
  #repository-overlay.visible { display: flex; }

  /* Repository modal — styled file dropzone (replaces a bare <input type=file>) */
  .file-dropzone {
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .file-dropzone input[type="file"] { display: none; }
  .file-dropzone:hover, .file-dropzone:focus-visible { border-color: var(--accent-2); outline: none; }
  .file-dropzone.drag-over { border-color: var(--accent-2); background: rgba(85,124,104,0.06); }
  .file-dropzone.has-file { border-style: solid; border-color: var(--accent-2); background: rgba(85,124,104,0.05); }
  .file-dropzone-content { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-dim); }
  .file-dropzone-content .icon-svg { width: 22px; height: 22px; }
  .file-dropzone-text { font-size: 12.5px; color: var(--text); word-break: break-all; }
  .file-dropzone-meta { font-size: 11px; color: var(--text-dim); }
  .file-status {
    font-size: 11.5px; color: var(--text-dim); margin-top: 6px;
    display: flex; align-items: center; gap: 6px; min-height: 16px;
  }
  .file-status .icon-svg { width: 13px; height: 13px; }
  .file-status .icon-svg:not(.spin) { color: var(--green); }
  .icon-svg.spin { animation: repo-upload-spin 0.8s linear infinite; }
  @keyframes repo-upload-spin { to { transform: rotate(360deg); } }

  /* Repository modal — tag input: chips + Tab-to-add suggestions dropdown */
  .tag-input {
    position: relative;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
    padding: 6px 8px;
  }
  .tag-input:focus-within { border-color: var(--accent); }
  .tag-chips { display: flex; flex-wrap: wrap; gap: 5px; }
  .tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
    border-radius: 20px; padding: 3px 6px 3px 10px; font-size: 11.5px;
  }
  .tag-chip-remove { display: flex; cursor: pointer; color: var(--text-dim); }
  .tag-chip-remove:hover { color: var(--red); }
  .tag-chip-remove .icon-svg { width: 11px; height: 11px; }
  #repository-tags-field {
    flex: 1; min-width: 100px; border: none; background: transparent; padding: 4px 2px;
    font-size: 12.5px; color: var(--text); outline: none;
  }
  .tag-suggestions {
    display: none;
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10;
    background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    max-height: 160px; overflow-y: auto;
  }
  .tag-suggestions.visible { display: block; }
  .tag-suggestion-item { padding: 7px 10px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
  .tag-suggestion-item:hover { background: var(--panel-2); color: var(--text); }

  @media (max-width: 640px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
    .gallery-hud { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
  }
  @media (max-width: 420px) {
    .gallery-grid { grid-template-columns: 1fr; }
    .gallery-panel-header { flex-wrap: wrap; }
    .hud-stat .hud-label { display: none; }
  }
