
/* ══ Community gallery ("Store") — premium storefront overlay ══════════════ */
.cgal-overlay { padding: 3.2vh 3vw; }
.cgal-modal {
  width: min(1080px, 100%);
  /* Locked height so switching category filters — which only swaps the scroll
     area's contents — can't resize the whole dialog on every click (#2). The
     scroll body (.cgal-scroll, flex:1) absorbs the difference and scrolls
     internally instead. Capped to the viewport on short screens. */
  height: min(880px, calc(100vh - 6vh));
  max-height: calc(100vh - 6vh);
  padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  border-radius: 22px;
}
.cgal-ic { display: inline-flex; line-height: 0; }
.cgal-ic svg { width: 1em; height: 1em; display: block; }

.cgal-iconbtn {
  appearance: none; cursor: pointer; width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: var(--text-dim, #8b91a1);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
  transition: background 0.15s ease, color 0.15s ease;
}
.cgal-iconbtn:hover { color: var(--text, #e7e9ee); background: rgba(255, 255, 255, 0.09); }
.cgal-iconbtn svg { width: 18px; height: 18px; }

/* ── Scroll body ── */
/* overflow-x is pinned rather than left to compute: `overflow-y: auto` alone
   turns the x axis into `auto` too, so ONE child that refuses to shrink pans
   the entire storefront sideways — headers, shelves and cards together, cut off
   at both edges with the cause nowhere near where it looks wrong. That is what
   a phone was getting. Anything genuinely wider than the panel (the card shelf,
   a card's screenshots) carries its own horizontal scroller, so clipping here
   costs nothing and keeps a future too-wide element a local defect. */
.cgal-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 22px 28px; min-height: 220px; }

/* ── Installed tab (js/installed-manager/installed-manager.js) ── */
/* Deliberately NOT a second gallery: this is an operational list, so rows are
   dense and text-first. Kind chips reuse the rail's visual language. */
.inst-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.inst-chip {
  display: inline-flex; align-items: center; white-space: nowrap; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--text-dim, #8b91a1); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.inst-chip:hover { color: var(--text, #e8eaf0); background: rgba(255, 255, 255, 0.08); }
.inst-chip.active { color: var(--accent, #35e08e); background: rgba(var(--accent-rgb), 0.16); border-color: rgba(var(--accent-rgb), 0.4); }

.inst-list { display: flex; flex-direction: column; gap: 8px; }
.inst-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
/* Legacy = imports from before receipts existed; they are removed as one group,
   so the dashed edge marks them as a different kind of row. */
.inst-row.is-legacy { border-style: dashed; }

/* Thumbnail: the catalog screenshot when the entry publishes one, otherwise the
   kind glyph. A fixed box either way so the rows stay on one rhythm — a list
   that jumps between framed and unframed rows reads as broken. */
.inst-thumb {
  flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.inst-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inst-thumb.is-glyph { color: var(--text-dim, #8b91a1); background: rgba(var(--accent-rgb), 0.07); border-color: rgba(var(--accent-rgb), 0.18); }
.inst-thumb.is-glyph svg { width: 22px; height: 22px; }

.inst-row-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.inst-row-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.inst-row-name { font-size: 0.94rem; line-height: 1.25; overflow-wrap: anywhere; color: var(--text, #e7e9ee); }
.inst-row-meta { font-size: 0.76rem; line-height: 1.4; color: var(--text-dim, #8b91a1); overflow-wrap: anywhere; }
.inst-kind {
  flex: none; padding: 2px 7px; border-radius: 999px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim, #8b91a1); background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
}
.inst-origin {
  flex: none; padding: 2px 7px; border-radius: 999px; font-size: 0.62rem; font-weight: 700;
  color: var(--text-dim, #8b91a1); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.inst-origin.is-mine { color: var(--accent, #35e08e); background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.3); }
/* Live activity chip fed by the widget perf probe (ok / busy / heavy / paused). */
.inst-activity {
  flex: none; padding: 2px 7px; border-radius: 999px; font-size: 0.62rem; font-weight: 700;
  color: var(--text-dim, #8b91a1); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.inst-activity.is-busy { color: var(--warn, #ffb454); background: rgba(255, 180, 84, 0.1); border-color: rgba(255, 180, 84, 0.3); }
.inst-activity.is-heavy { color: var(--red, #ff5b6a); background: rgba(255, 91, 106, 0.1); border-color: rgba(255, 91, 106, 0.32); }
.inst-activity.is-paused { color: var(--text-dim, #8b91a1); background: rgba(255, 255, 255, 0.08); border-style: dashed; }
.inst-row-btns { display: flex; align-items: center; gap: 8px; flex: none; }
/* A widget's own options (widget-options-panel.js), opened under its name. */
.inst-opts { display: flex; flex-direction: column; gap: 4px; max-width: 560px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--glass-border); }
/* Open, the row grows down: thumbnail and keys stay at its top instead of its middle. */
@media (min-width: 561px) {
  .inst-row:has(> .inst-row-info > .inst-opts:not([hidden])) { align-items: flex-start; }
}
.inst-opts[hidden] { display: none; }
.inst-opt-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 0 7px; font-size: 12.5px; font-weight: 850; color: var(--text); }
.inst-opt-name { min-width: 0; overflow-wrap: anywhere; }
.inst-opt-line .settings-select { flex: 0 1 auto; max-width: 60%; }
.inst-opt-group { margin: 6px 7px 0; font-size: 0.76rem; font-weight: 650; color: var(--text-dim); }
.inst-opt-switches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.inst-opt-reset { align-self: flex-start; margin-top: 4px; }
/* What the row waits on from you (installed-manager.js needsYou): full ink and
   weight among the dim lines, so a scan of the list finds it. */
.inst-row-state { font-size: 0.8rem; line-height: 1.35; font-weight: 600; color: var(--text, #e7e9ee); overflow-wrap: anywhere; }
/* Not a task for the person, a fact about this PC: quieter than the rows above. */
.inst-row-state.is-left-out { font-weight: 500; color: var(--text-dim, #8b91a1); }
/* The publisher's note about what a pending update changes. */
.inst-row-changelog {
  font-size: 0.76rem; line-height: 1.4; color: var(--accent, #35e08e);
  overflow-wrap: anywhere; font-style: italic;
}
/* What the sandbox refuses in the user's own widget (installed-manager.js
   attachSandboxIssues). Collapsed by default: the summary line is the signal,
   the per-kind fixes open on tap. Same warning tint as .inst-rejected. */
.inst-issues {
  margin-top: 2px; padding: 8px 11px; border-radius: 10px;
  background: color-mix(in srgb, var(--warning, #e0a33e) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning, #e0a33e) 30%, transparent);
}
.inst-issues-title {
  cursor: pointer; min-height: 28px; display: flex; align-items: center;
  font-size: 0.78rem; font-weight: 600; color: var(--text, #e7e9ee);
}
.inst-issues-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 8px; }
.inst-issues-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; min-width: 0; }
.inst-issues-kind { font-size: 0.76rem; font-weight: 600; color: var(--text, #e7e9ee); }
.inst-issues-where {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem; padding: 1px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.22); color: var(--text, #e7e9ee);
  overflow-wrap: anywhere; min-width: 0;
}
.inst-issues-fix { flex: 1 1 100%; font-size: 0.74rem; line-height: 1.4; color: var(--muted-text, #aab1c0); }
.inst-issues-foot { margin: 0; font-size: 0.72rem; line-height: 1.4; color: var(--text-dim, #8b91a1); overflow-wrap: anywhere; }

/* "N updates available · Update all" — sits above the list, so the answer to
   "is anything waiting?" is the first thing the tab says. */
.inst-updbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0 0 14px; padding: 10px 14px; border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
}
.inst-updbar-txt { font-size: 0.82rem; font-weight: 600; color: var(--text, #e7e9ee); }
.inst-updbar .settings-btn { flex: none; }
@media (max-width: 560px) {
  .inst-updbar { flex-direction: column; align-items: stretch; gap: 10px; }
}

/* Widget folders the scan refused. Warning-toned, not error-toned: nothing is
   broken, a folder just needs renaming — and it must read as actionable rather
   than alarming. Uses the theme's warning role so it follows light/dark and the
   Comic/Retro skins instead of pinning its own colour. */
.inst-rejected {
  margin: 0 0 14px; padding: 11px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--warning, #e0a33e) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning, #e0a33e) 34%, transparent);
}
.inst-rejected-title {
  margin: 0 0 8px; font-size: 0.82rem; font-weight: 600;
  color: var(--text, #e7e9ee);
}
.inst-rejected-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.inst-rejected-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; }
.inst-rejected-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem; padding: 2px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.22); color: var(--text, #e7e9ee);
  /* A pasted folder name can be long and has no spaces to break on. */
  overflow-wrap: anywhere;
}
.inst-rejected-why { font-size: 0.78rem; color: var(--muted-text, #aab1c0); flex: 1 1 220px; min-width: 0; }
.inst-rejected .cgal-status { margin: 0; }

.inst-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
}
.inst-foot .cgal-status { padding: 0; text-align: left; font-size: 0.76rem; }
.inst-foot .settings-btn { flex: none; }

.inst-empty { padding: 52px 6px; text-align: center; }
.inst-empty-title { margin: 0 0 6px; font-size: 1.02rem; font-weight: 700; color: var(--text, #e7e9ee); }
.inst-empty .cgal-status { padding: 0 0 18px; max-width: 46ch; margin: 0 auto; }

@media (max-width: 560px) {
  .inst-row { flex-direction: column; align-items: stretch; }
  /* Three buttons are wider than a phone row: wrap and share the width instead
     of running past the row's left edge. */
  .inst-row-btns { flex-wrap: wrap; justify-content: flex-end; }
  .inst-row-btns > * { flex: 1 1 auto; }
  .inst-foot { flex-direction: column; align-items: stretch; }
  .inst-foot .settings-btn { width: 100%; }
}
.cgal-select { position: relative; flex: none; }
/* The two toolbar dropdowns are upgraded to the app's CustomSelect (the native
   OS popup read as cheap) — size its trigger to sit level with the search field. */
.cgal-select .cs-wrap { display: flex; }
.cgal-select .cs-trigger { padding: 11px 12px 11px 14px; border-radius: 12px; font-size: 0.82rem; min-width: 108px; }
/* On a phone the search takes its own row and the menus share the next one. */
@media (max-width: 600px) {
  .cgal-select { flex: 1 1 0; min-width: 0; }
  .cgal-select .cs-trigger { width: 100%; min-width: 0; }
}
/* "N new since your last visit" count dot on the Settings entry points to the Store
   (#5). The key is made position:relative so the dot sits at its corner; a fixed red
   keeps it readable on the green. */
.settings-store-open { position: relative; overflow: visible; }
.cgal-store-dot {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 800; line-height: 1; border-radius: 999px;
  color: #fff; background: #e5484d; border: 1.5px solid var(--panel, #12151c);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
/* Accent variant of the Store dot: shown only when there are no updates but there
   ARE new items since the last visit — discovery, not a call to action (#5). */
.cgal-store-dot.is-new { background: var(--accent, #35e08e); color: #04240f; border-color: var(--panel, #12151c); }
/* On the topbar Settings gear the count sits at the TOP-LEFT corner: the
   top-right is the app-update dot's spot (UpdateModal.css), and the two can be
   up at the same time — an update and new Store content are different news. */
.qbtn-settings .cgal-store-dot { top: 2px; left: 6px; right: auto; }
.cgal-authorstar { color: var(--warn, #ffb454); }
/* Star ratings: the async-filled card slot and the detail view's vote row. */
.cgal-stars { margin-left: 6px; color: var(--warn, #ffb454); font-weight: 600; white-space: nowrap; }
/* Install count: deliberately quieter than the rating. It is a rough popularity
   signal, not a quality one, and it should never out-shout the stars. */
.cgal-installs { margin-left: 6px; color: var(--text-dim, #8b91a1); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cgal-installs:empty { display: none; }
.cgal-rate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.cgal-rate-avg { font-size: 0.8rem; color: var(--text-dim, #8b91a1); }
