/* ============================================================================
   Client Brain -> Images : the Studio    (house-style redesign, 30 Aug 2026)
   ----------------------------------------------------------------------------
   Ben, 30 Aug: "Everything for the site is still using old styling, old fonts.
   This needs a full redesign." This sheet replaces cm-images-tab.css entirely.

   WHY A NEW NAMESPACE (.ist-*, was .imt-*)
   The tab sits inside the dashboard's editorial theme, which styles inputs,
   selects and textareas globally with SIXTEEN !important declarations
   (editorial-overlay.css:453), promotes anything matching [class*="-chip"] to
   a 999px pill, and rewrites .imt-panel into a flat card. Overriding all that
   means an !important arms race on every property. A namespace the old rules
   simply do not match is cheaper and stays readable. Nothing else in the repo
   used .imt-* except this tab, so the old sheet retires with it.

   Names here deliberately avoid the -chip / -pill / -tag / -badge / .card
   suffixes, because sales-cards.css catches those with global attribute
   selectors.

   DESIGN LANGUAGE — onboard.optdigital.io house style (Ben's standing rule):
     Inter Tight throughout (already loaded in base.html), Cormorant Garamond
     for the display line, #f4e14a accent, white cards at 22px radius on a
     #fbfbf9 ground, pill buttons that fill yellow when active, inputs at
     14px radius with a 4px yellow focus ring, and 11.5px/700 letter-spaced
     uppercase kickers in --ink-mute (Inter Tight, NOT mono — the mono
     uppercase labels were most of the "old fonts" Ben was seeing).
   ========================================================================== */

html body #cmImages {
  /* Scoped so nothing leaks into the rest of the dashboard. */
  --ist-yellow: #f4e14a;
  --ist-yellow-deep: #f5c518;
  --ist-ink: #15161a;
  --ist-ink-soft: #3b3d44;
  --ist-ink-mute: #8a8d96;
  --ist-paper: #ffffff;
  --ist-bg: #fbfbf9;
  --ist-line: #e9e6da;
  --ist-line-soft: #f1efe7;
  --ist-good: #16a34a;
  --ist-warn: #b8860b;
  --ist-bad: #e0561e;
  --ist-radius: 22px;
  --ist-radius-sm: 14px;
  --ist-float: 0 1px 2px rgba(20, 22, 30, .04), 0 36px 80px -46px rgba(20, 22, 30, .34);
  --ist-display: "Cormorant Garamond", Georgia, serif;
  --ist-body: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;

  font-family: var(--ist-body);
  color: var(--ist-ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
html body #cmImages *,
html body #cmImages *::before,
html body #cmImages *::after { box-sizing: border-box; }

/* ── Page head ─────────────────────────────────────────────────────────── */
html body #cmImages .ist-kicker {
  font-family: var(--ist-body);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ist-ink-mute);
  margin: 0 0 10px;
}
html body #cmImages .ist-title {
  font-family: var(--ist-display);
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -.005em;
  margin: 0 0 8px;
  color: var(--ist-ink);
  text-transform: none;
}
html body #cmImages .ist-lede {
  color: var(--ist-ink-soft);
  max-width: 74ch;
  font-size: 15px;
  margin: 0;
}
html body #cmImages .ist-head { margin: 2px 0 22px; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
html body #cmImages .ist-card {
  background: var(--ist-paper);
  border: 1px solid var(--ist-line);
  border-radius: var(--ist-radius);
  box-shadow: var(--ist-float);
  padding: 26px 28px;
}
html body #cmImages .ist-card + .ist-card { margin-top: 20px; }
html body #cmImages .ist-h2 {
  font-family: var(--ist-display);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.005em;
  margin: 0 0 4px;
  color: var(--ist-ink);
  text-transform: none;
}
html body #cmImages .ist-sub {
  margin: 0 0 20px;
  color: var(--ist-ink-soft);
  font-size: 13.5px;
  max-width: 68ch;
}

/* ── Two-column shell: composer + client rail ──────────────────────────── */
html body #cmImages .ist-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
html body #cmImages .ist-rail { display: grid; gap: 20px; }
html body #cmImages .ist-rail .ist-card { padding: 22px; }

/* ── Fields ────────────────────────────────────────────────────────────── */
html body #cmImages .ist-field { display: block; margin-bottom: 22px; }
html body #cmImages .ist-field:last-child { margin-bottom: 0; }
html body #cmImages .ist-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ist-ink-mute);
  margin: 0 0 9px;
}
html body #cmImages .ist-label-lg {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ist-ink);
  margin-bottom: 10px;
}
html body #cmImages .ist-hint {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12.5px;
  color: var(--ist-ink-mute);
  margin-left: 8px;
}

/* The editorial overlay styles every input/textarea/select with !important,
   so these have to answer in kind. Higher specificity alone loses. */
html body #cmImages input.ist-input,
html body #cmImages textarea.ist-input,
html body #cmImages select.ist-input {
  width: 100% !important;
  font-family: var(--ist-body) !important;
  font-size: 14.5px !important;
  line-height: 1.5 !important;
  color: var(--ist-ink) !important;
  background: var(--ist-paper) !important;
  border: 1px solid var(--ist-line) !important;
  border-radius: var(--ist-radius-sm) !important;
  padding: 12px 15px !important;
  outline: none !important;
  transition: border-color .14s, box-shadow .14s;
  appearance: none;
}
html body #cmImages textarea.ist-input { resize: vertical; min-height: 92px; }
html body #cmImages input.ist-input:focus,
html body #cmImages textarea.ist-input:focus,
html body #cmImages select.ist-input:focus {
  border-color: var(--ist-yellow-deep) !important;
  box-shadow: 0 0 0 4px rgba(244, 225, 74, .28) !important;
}
html body #cmImages input.ist-input::placeholder,
html body #cmImages textarea.ist-input::placeholder {
  color: var(--ist-ink-mute) !important;
  opacity: 1;
}
html body #cmImages textarea.ist-brief {
  min-height: 116px;
  font-size: 16px !important;
  padding: 15px 17px !important;
}
html body #cmImages select.ist-input {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ist-ink-soft) 50%),
                    linear-gradient(135deg, var(--ist-ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 2px), calc(100% - 14px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px !important;
}

/* ── Buttons: pills, yellow when primary ───────────────────────────────── */
html body #cmImages button.ist-btn,
html body #cmImages a.ist-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px !important;
  font-family: var(--ist-body) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  line-height: 1 !important;
  color: var(--ist-ink) !important;
  background: var(--ist-paper) !important;
  border: 1px solid var(--ist-line) !important;
  border-radius: 999px !important;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, transform .1s;
}
html body #cmImages button.ist-btn:hover,
html body #cmImages a.ist-btn:hover {
  border-color: var(--ist-ink) !important;
  background: var(--ist-paper) !important;
}
html body #cmImages button.ist-btn:active { transform: translateY(1px); }
html body #cmImages button.ist-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
html body #cmImages button.ist-btn-primary {
  background: var(--ist-yellow) !important;
  border-color: var(--ist-yellow) !important;
  color: var(--ist-ink) !important;
  font-weight: 700 !important;
  padding: 13px 30px !important;
  font-size: 14px !important;
}
html body #cmImages button.ist-btn-primary:hover {
  background: var(--ist-yellow-deep) !important;
  border-color: var(--ist-yellow-deep) !important;
}
html body #cmImages button.ist-btn-sm,
html body #cmImages a.ist-btn-sm {
  padding: 7px 13px !important;
  font-size: 12px !important;
}
html body #cmImages button.ist-btn-quiet {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--ist-ink-mute) !important;
  padding: 6px 10px !important;
}
html body #cmImages button.ist-btn-quiet:hover {
  color: var(--ist-ink) !important;
  background: var(--ist-line-soft) !important;
  border-color: transparent !important;
}
html body #cmImages button.ist-btn-danger { color: var(--ist-bad) !important; }
html body #cmImages button.ist-btn-danger:hover {
  border-color: var(--ist-bad) !important;
}
html body #cmImages button.ist-btn.is-confirm {
  background: var(--ist-bad) !important;
  border-color: var(--ist-bad) !important;
  color: #fff !important;
}

/* ── Presets ───────────────────────────────────────────────────────────── */
html body #cmImages .ist-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 9px;
}
html body #cmImages button.ist-preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 11px 12px 12px !important;
  font-family: var(--ist-body) !important;
  background: var(--ist-paper) !important;
  border: 1px solid var(--ist-line) !important;
  border-radius: var(--ist-radius-sm) !important;
  cursor: pointer;
  color: var(--ist-ink) !important;
  transition: border-color .14s, background .14s, transform .1s;
}
html body #cmImages button.ist-preset:hover {
  border-color: var(--ist-ink-mute) !important;
  transform: translateY(-1px);
}
html body #cmImages button.ist-preset.is-on {
  border-color: var(--ist-yellow-deep) !important;
  background: rgba(244, 225, 74, .16) !important;
}
html body #cmImages .ist-preset-ico {
  width: 20px; height: 20px;
  color: var(--ist-ink-soft);
  margin-bottom: 3px;
}
html body #cmImages button.ist-preset.is-on .ist-preset-ico { color: var(--ist-ink); }
html body #cmImages .ist-preset-name {
  font-size: 13px; font-weight: 600; line-height: 1.25;
}
html body #cmImages .ist-preset-note {
  font-size: 11.5px; line-height: 1.3; color: var(--ist-ink-mute);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Segmented choices ─────────────────────────────────────────────────── */
html body #cmImages .ist-choices { display: flex; flex-wrap: wrap; gap: 8px; }
html body #cmImages button.ist-choice {
  padding: 9px 17px !important;
  font-family: var(--ist-body) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--ist-ink-soft) !important;
  background: var(--ist-paper) !important;
  border: 1px solid var(--ist-line) !important;
  border-radius: 999px !important;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
}
html body #cmImages button.ist-choice:hover {
  border-color: var(--ist-ink-mute) !important;
}
html body #cmImages button.ist-choice.is-on {
  background: var(--ist-yellow) !important;
  border-color: var(--ist-yellow) !important;
  color: var(--ist-ink) !important;
  font-weight: 700 !important;
}
html body #cmImages .ist-choice-row {
  display: flex; flex-wrap: wrap; gap: 26px 40px;
}
html body #cmImages .ist-choice-group { min-width: 0; }

/* ── Scene ideas ───────────────────────────────────────────────────────── */
html body #cmImages .ist-ideas { display: flex; flex-wrap: wrap; gap: 8px; }
html body #cmImages button.ist-idea {
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  padding: 8px 14px !important;
  font-family: var(--ist-body) !important;
  font-size: 12.5px !important;
  font-weight: 400 !important;
  text-align: left;
  line-height: 1.35 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--ist-ink-soft) !important;
  background: var(--ist-bg) !important;
  border: 1px solid var(--ist-line) !important;
  border-radius: 999px !important;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}
html body #cmImages button.ist-idea:hover {
  background: rgba(244, 225, 74, .18) !important;
  border-color: var(--ist-yellow-deep) !important;
}
html body #cmImages .ist-row-between {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 9px;
}

/* ── References ────────────────────────────────────────────────────────── */
html body #cmImages .ist-ref-add { display: flex; flex-wrap: wrap; gap: 8px; }
html body #cmImages .ist-refs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
html body #cmImages .ist-ref {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px;
  background: var(--ist-bg);
  border: 1px solid var(--ist-line);
  border-radius: var(--ist-radius-sm);
}
html body #cmImages .ist-ref-media {
  flex: 0 0 46px; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: var(--ist-paper);
  border: 1px solid var(--ist-line);
  border-radius: 10px;
}
html body #cmImages .ist-ref-media img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
html body #cmImages .ist-ref-body {
  min-width: 0; flex: 1 1 auto; display: grid; gap: 5px;
}
html body #cmImages .ist-ref-name {
  font-size: 12.5px; font-weight: 500; color: var(--ist-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html body #cmImages select.ist-ref-role {
  width: 100% !important;
  max-width: 132px;
  padding: 5px 26px 5px 9px !important;
  font-size: 12px !important;
  border-radius: 999px !important;
  background-position: calc(100% - 14px) calc(50% + 2px), calc(100% - 9px) calc(50% + 2px);
}
html body #cmImages button.ist-ref-x {
  position: absolute; top: 5px; right: 6px;
  width: 20px; height: 20px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  border: 0 !important; background: transparent !important;
  color: var(--ist-ink-mute) !important;
  font-size: 17px; line-height: 1; cursor: pointer;
  border-radius: 999px !important;
}
html body #cmImages button.ist-ref-x:hover {
  color: var(--ist-bad) !important;
  background: rgba(224, 86, 30, .1) !important;
}
html body #cmImages .ist-ref-empty {
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px dashed var(--ist-line);
  border-radius: var(--ist-radius-sm);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ist-ink-mute);
}

/* ── Prompt + generate ─────────────────────────────────────────────────── */
html body #cmImages textarea.ist-prompt {
  min-height: 104px;
  font-size: 13.5px !important;
  line-height: 1.62 !important;
  color: var(--ist-ink-soft) !important;
  background: var(--ist-bg) !important;
}
html body #cmImages .ist-note {
  margin-top: 8px; font-size: 12.5px; color: var(--ist-ink-mute); min-height: 1em;
}
html body #cmImages .ist-note.is-warn { color: var(--ist-warn); }
html body #cmImages .ist-go {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--ist-line-soft);
}
html body #cmImages .ist-status {
  flex: 1 1 auto; font-size: 13px; color: var(--ist-ink-soft);
}
html body #cmImages .ist-status.is-error { color: var(--ist-bad); }
html body #cmImages .ist-status.is-warn { color: var(--ist-warn); }

/* ── Site-logo rail ────────────────────────────────────────────────────── */
html body #cmImages .ist-logo-box {
  width: 100%; height: 116px;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background: var(--ist-bg);
  border: 1px solid var(--ist-line);
  border-radius: var(--ist-radius-sm);
  margin-bottom: 14px;
  overflow: hidden;
  font-size: 12.5px; color: var(--ist-ink-mute);
}
html body #cmImages .ist-logo-box img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
html body #cmImages .ist-logo-acts { display: flex; flex-wrap: wrap; gap: 7px; }
html body #cmImages .ist-logo-src {
  margin-top: 11px; font-size: 12px; line-height: 1.45; color: var(--ist-ink-mute);
}
html body #cmImages .ist-logo-src a { color: var(--ist-ink-soft); }

/* ── Library ───────────────────────────────────────────────────────────── */
html body #cmImages .ist-lib-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 16px;
}
html body #cmImages .ist-count {
  font-family: var(--ist-body);
  font-size: 15px; font-weight: 400; color: var(--ist-ink-mute);
}
html body #cmImages .ist-filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
html body #cmImages input.ist-search { width: 260px !important; }

html body #cmImages .ist-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 16px;
}
html body #cmImages .ist-item {
  background: var(--ist-paper);
  border: 1px solid var(--ist-line);
  border-radius: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .14s, transform .12s, box-shadow .14s;
}
html body #cmImages .ist-item:hover {
  border-color: var(--ist-ink-mute);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -30px rgba(20, 22, 30, .4);
}
html body #cmImages .ist-item.is-rejected { opacity: .5; }
html body #cmImages .ist-item-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--ist-bg);
  cursor: zoom-in;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
html body #cmImages .ist-item-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
html body #cmImages .ist-item-none {
  font-size: 12px; color: var(--ist-ink-mute);
}
html body #cmImages .ist-marks {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start;
  pointer-events: none;
}
html body #cmImages .ist-mark {
  pointer-events: auto;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: var(--ist-ink);
  border: 1px solid var(--ist-line);
  text-decoration: none;
  backdrop-filter: blur(6px);
}
html body #cmImages .ist-mark.is-on { background: var(--ist-good); color: #fff; border-color: var(--ist-good); }
html body #cmImages .ist-mark.is-off { background: var(--ist-bad); color: #fff; border-color: var(--ist-bad); }
html body #cmImages .ist-mark.is-src { background: rgba(21, 22, 26, .82); color: #fff; border-color: transparent; }
html body #cmImages .ist-mark.is-warn { background: var(--ist-warn); color: #fff; border-color: var(--ist-warn); }
html body #cmImages .ist-marks-r { margin-left: auto; }

html body #cmImages .ist-item-body { padding: 13px 15px 15px; display: grid; gap: 11px; }
html body #cmImages .ist-item-text {
  font-size: 12.5px; line-height: 1.45; color: var(--ist-ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
html body #cmImages .ist-item-acts { display: flex; flex-wrap: wrap; gap: 6px; }
html body #cmImages .ist-item-acts button.ist-btn,
html body #cmImages .ist-item-acts a.ist-btn {
  padding: 6px 12px !important; font-size: 11.5px !important;
}

/* Skeleton while a generation streams */
html body #cmImages .ist-item-wait .ist-item-media {
  background: linear-gradient(100deg, var(--ist-bg) 30%, #f4f2ea 50%, var(--ist-bg) 70%);
  background-size: 220% 100%;
  animation: istShimmer 1.5s linear infinite;
  cursor: default;
}
@keyframes istShimmer { to { background-position: -220% 0; } }

html body #cmImages .ist-empty {
  padding: 44px 24px;
  text-align: center;
  border: 1px dashed var(--ist-line);
  border-radius: var(--ist-radius-sm);
  color: var(--ist-ink-mute);
  font-size: 13.5px;
}
html body #cmImages .ist-loading {
  padding: 44px 24px; text-align: center;
  color: var(--ist-ink-mute); font-size: 13.5px;
}

/* ── Drive health banner ───────────────────────────────────────────────── */
html body #cmImages .ist-banner {
  border-radius: var(--ist-radius-sm);
  padding: 17px 19px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}
html body #cmImages .ist-banner.is-err {
  background: #fdf1ec; border-color: #f2c9b6; color: #8a3a17;
}
html body #cmImages .ist-banner.is-warn {
  background: #fdf8e8; border-color: #ecd9a0; color: #7a5c0d;
}
html body #cmImages .ist-banner-t { font-weight: 700; margin-bottom: 7px; }
html body #cmImages .ist-banner ul { margin: 0; padding-left: 18px; }
html body #cmImages .ist-banner li + li { margin-top: 4px; }
html body #cmImages .ist-banner-go {
  margin-top: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
html body #cmImages a.ist-reconnect {
  display: inline-flex; align-items: center;
  padding: 9px 17px;
  border-radius: 999px;
  background: var(--ist-ink);
  color: #fff !important;
  font-size: 12.5px; font-weight: 600;
  text-decoration: none !important;
}
html body #cmImages a.ist-reconnect:hover { background: #000; }
html body #cmImages .ist-banner-note { font-size: 12px; opacity: .85; }

/* ── Lightbox ──────────────────────────────────────────────────────────── */
html body .ist-lightbox {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(16, 17, 20, .8);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 28px;
}
html body .ist-lightbox[hidden] { display: none !important; }
html body .ist-lightbox-frame {
  margin: 0;
  max-width: 1000px; max-height: 100%;
  display: flex; flex-direction: column; gap: 14px;
}
html body .ist-lightbox-img {
  max-width: 100%; max-height: 68vh;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
}
html body .ist-lightbox figcaption {
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  font-family: "Inter Tight", system-ui, sans-serif;
  display: grid; gap: 12px;
}
html body .ist-lightbox-text {
  font-size: 13px; line-height: 1.5; color: #3b3d44;
  max-height: 88px; overflow: auto;
}
html body .ist-lightbox-acts { display: flex; flex-wrap: wrap; gap: 8px; }
html body button.ist-lightbox-x {
  position: absolute; top: 18px; right: 22px;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .14);
  color: #fff; font-size: 26px; line-height: 1;
}
html body button.ist-lightbox-x:hover { background: rgba(255, 255, 255, .26); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  html body #cmImages .ist-shell { grid-template-columns: minmax(0, 1fr); }
  html body #cmImages .ist-rail {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}
@media (max-width: 720px) {
  html body #cmImages .ist-card { padding: 20px 18px; }
  html body #cmImages .ist-presets { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); }
  html body #cmImages .ist-gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  html body #cmImages input.ist-search { width: 100% !important; }
  html body #cmImages .ist-choice-row { gap: 18px; }
}

/* ============================================================================
   ROUNDER EDGES + QUEUE  —  30 Aug 2026
   Ben: "Just make some of the edges rounded", plus the generation queue.
   ========================================================================== */

/* ── Rounder throughout ────────────────────────────────────────────────────
   The 14px small radius read as square next to the 22px cards. Everything
   steps up so the whole surface reads as one soft family. */
html body #cmImages {
  --ist-radius: 26px;
  --ist-radius-sm: 18px;
}
html body #cmImages .ist-rail .ist-card { border-radius: 22px; }
html body #cmImages button.ist-preset { border-radius: 18px !important; }
html body #cmImages .ist-ref { border-radius: 18px; }
html body #cmImages .ist-ref-media { border-radius: 13px; }
html body #cmImages .ist-ref-empty { border-radius: 18px; }
html body #cmImages .ist-logo-box { border-radius: 18px; }
html body #cmImages .ist-banner { border-radius: 18px; }
html body #cmImages .ist-empty { border-radius: 18px; }
html body #cmImages .ist-item { border-radius: 22px; }
html body #cmImages .ist-lightbox-img { border-radius: 22px; }
html body .ist-lightbox figcaption { border-radius: 22px; }

/* ── Queue ─────────────────────────────────────────────────────────────── */
html body #cmImages .ist-queue {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
html body #cmImages .ist-job {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--ist-bg);
  border: 1px solid var(--ist-line);
  border-radius: 18px;
  transition: border-color .14s, background .14s, opacity .2s;
}
html body #cmImages .ist-job.is-running {
  border-color: var(--ist-yellow-deep);
  background: rgba(244, 225, 74, .14);
}
html body #cmImages .ist-job.is-done { opacity: .55; }
html body #cmImages .ist-job.is-failed {
  border-color: #f2c9b6;
  background: #fdf1ec;
}
html body #cmImages .ist-job-n {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--ist-paper);
  border: 1px solid var(--ist-line);
  font-size: 11.5px; font-weight: 700;
  color: var(--ist-ink-soft);
}
html body #cmImages .ist-job.is-running .ist-job-n {
  background: var(--ist-yellow);
  border-color: var(--ist-yellow);
  color: var(--ist-ink);
}
html body #cmImages .ist-job-body {
  min-width: 0; flex: 1 1 auto;
  display: grid; gap: 2px;
}
html body #cmImages .ist-job-text {
  font-size: 13px; line-height: 1.35; color: var(--ist-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html body #cmImages .ist-job-meta {
  font-size: 11.5px; color: var(--ist-ink-mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html body #cmImages .ist-job-state {
  flex: 0 0 auto;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ist-ink-mute);
  white-space: nowrap;
}
html body #cmImages .ist-job.is-running .ist-job-state { color: var(--ist-warn); }
html body #cmImages .ist-job.is-failed .ist-job-state { color: var(--ist-bad); }
html body #cmImages button.ist-job-x {
  flex: 0 0 auto;
  width: 22px; height: 22px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  border: 0 !important; background: transparent !important;
  color: var(--ist-ink-mute) !important;
  font-size: 17px; line-height: 1; cursor: pointer;
  border-radius: 999px !important;
}
html body #cmImages button.ist-job-x:hover {
  color: var(--ist-bad) !important;
  background: rgba(224, 86, 30, .1) !important;
}
html body #cmImages #istQueueWrap { margin-bottom: 22px; }

/* ── Lightbox buttons ──────────────────────────────────────────────────────
   openLightbox() re-parents the overlay to <body> so position:fixed escapes
   any transform/filter ancestor. That also moves it OUT of #cmImages, so the
   `html body #cmImages button.ist-btn` rules above stop matching and the
   action row fell back to raw browser buttons (Ben spotted it, 30 Aug).
   Repeat the button styling scoped to the overlay itself. */
html body #istLightbox button.ist-btn,
html body #istLightbox a.ist-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px !important;
  font-family: "Inter Tight", "Inter", system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  line-height: 1 !important;
  color: #15161a !important;
  background: #ffffff !important;
  border: 1px solid #e9e6da !important;
  border-radius: 999px !important;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .14s, border-color .14s;
}
html body #istLightbox button.ist-btn:hover,
html body #istLightbox a.ist-btn:hover {
  border-color: #15161a !important;
}
html body #istLightbox button.ist-btn-primary,
html body #istLightbox a.ist-btn-primary {
  background: #f4e14a !important;
  border-color: #f4e14a !important;
  color: #15161a !important;
  font-weight: 700 !important;
}
html body #istLightbox button.ist-btn-primary:hover,
html body #istLightbox a.ist-btn-primary:hover {
  background: #f5c518 !important;
  border-color: #f5c518 !important;
}

/* ── Generation progress ───────────────────────────────────────────────────
   A generation blocks for 70-90s and the skeleton cards sit below the fold,
   so from the button's point of view nothing happened for a minute and a
   half (Ben, 30 Aug: "There's no feedback when I click generating"). */
html body #cmImages .ist-progress {
  margin-top: 22px;
  padding: 15px 18px;
  background: var(--ist-bg);
  border: 1px solid var(--ist-line);
  border-radius: 18px;
}
html body #cmImages .ist-progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--ist-line);
  overflow: hidden;
}
html body #cmImages .ist-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ist-yellow), var(--ist-yellow-deep));
  transition: width .5s linear;
}
html body #cmImages .ist-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ist-ink-soft);
}
html body #cmImages .ist-progress-time {
  font-variant-numeric: tabular-nums;
  color: var(--ist-ink-mute);
  white-space: nowrap;
}
