/* Integrations (dashboard section and fix-it page) and the /premium page.
   Builds on retro.css (tokens, .panel, .btn, .form, .notice, .table, .copy-block); every token has a
   fallback so these pages still look right on their own. */

/* ── Dashboard panel ──────────────────────────────────────────────────────── */

.rr-int {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.rr-int-lede {
  margin: 0;
  line-height: 1.45;
}

.rr-int-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
  align-items: start;
}

.rr-int-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--rr-panel, #ffffff);
  border: 3px solid var(--rr-border, #c9b98a);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--rr-border, #c9b98a);
}
.rr-int-card-live { border-color: var(--rr-green, #1fa34a); box-shadow: 0 3px 0 var(--rr-green, #1fa34a); }
.rr-int-card-pending { border-color: var(--rr-orange, #ff8a00); box-shadow: 0 3px 0 var(--rr-orange, #ff8a00); }
.rr-int-card-failed,
.rr-int-card-disabled { border-color: var(--rr-red, #e8392c); box-shadow: 0 3px 0 var(--rr-red, #e8392c); }
.rr-int-card-paused { border-style: dashed; }
.rr-int-card-soon { border-style: dashed; background: transparent; box-shadow: none; }

.rr-int-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: space-between;
}

.rr-int-name {
  margin: 0;
  font-size: 16px;
  color: var(--rr-navy, #1b2a6b);
}

.rr-int-tagline,
.rr-int-meaning {
  margin: 0;
  line-height: 1.4;
}
.rr-int-meaning {
  padding: 6px 8px;
  background: var(--rr-bg, #fffbea);
  border-radius: 6px;
}

/* Status chips: icon + words, never color alone. */
.rr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--rr-panel, #ffffff);
}
.rr-chip-icon { font-size: 11px; }
.rr-chip-off { color: #5b5b6b; }
.rr-chip-live { color: #127235; background: #e6f8ec; }
.rr-chip-pending { color: #9a4f00; background: #fff1dc; }
.rr-chip-failed,
.rr-chip-disabled { color: #b0231a; background: #fde8e6; }
.rr-chip-paused { color: #4b3b8f; background: #efeafd; }

.rr-int-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 10px;
  margin: 0;
  font-size: 12px;
}
.rr-int-facts dt { font-weight: bold; color: var(--rr-navy, #1b2a6b); }
.rr-int-facts dd { margin: 0; overflow-wrap: anywhere; }

.rr-int-origins {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rr-int-edit > summary,
.rr-int-code > summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--rr-blue, #1f6feb);
  padding: 4px 0;
}
.rr-int-edit > summary:focus-visible,
.rr-int-code > summary:focus-visible {
  outline: 3px solid var(--rr-yellow, #ffd23f);
  outline-offset: 2px;
  border-radius: 4px;
}

.rr-int-form input[type="text"],
.rr-int-form textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
}

.rr-int-disconnect { margin: 0; }

.rr-int-locked {
  margin: 0;
  font-weight: bold;
}

/* "We found your Supabase project" suggestions */
.rr-int-suggestions {
  display: grid;
  gap: 8px;
}
.rr-int-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #eef6ff;
  border: 2px dashed var(--rr-blue, #1f6feb);
  border-radius: 8px;
}
.rr-int-suggest-text {
  margin: 0;
  flex: 1 1 260px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.rr-int-suggest-form { margin: 0; }

/* Premium teaser for free creators */
.rr-int-teaser {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 12px 14px;
  border: 3px solid var(--rr-purple, #8a3ffc);
  border-radius: 10px;
  background: linear-gradient(180deg, #f6efff 0%, #ffffff 100%);
}
.rr-int-teaser p { margin: 0; line-height: 1.4; }
.rr-int-teaser-title {
  color: var(--rr-purple, #8a3ffc);
  font-size: 12px;
  letter-spacing: 1px;
}

/* Code sample */
.rr-int-code {
  padding: 8px 12px;
  border: 2px solid var(--rr-border, #c9b98a);
  border-radius: 8px;
  background: var(--rr-panel, #ffffff);
}
.rr-int-snippet { margin: 8px 0 12px; }
.rr-int-snippet pre {
  margin: 4px 0 6px;
  overflow-x: auto;
  white-space: pre;
}
.rr-int-snippet-active > p { color: #127235; }

.rr-int-fix { max-width: 720px; margin: 8px auto 24px; }

/* ── /premium ─────────────────────────────────────────────────────────────── */

.rr-premium {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* lets the wide plans table scroll instead of widening the page */
  gap: 16px;
}

.rr-premium-hero {
  background: linear-gradient(180deg, #fff6c9 0%, var(--rr-panel, #ffffff) 70%);
}
.rr-premium-lede {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.45;
}
.rr-premium-you { margin: 0 0 10px; }
.rr-premium-you-on {
  padding: 6px 10px;
  border-radius: 6px;
  background: #e6f8ec;
  border: 2px solid var(--rr-green, #1fa34a);
}
.rr-premium-invite p { margin: 0; }

.rr-plans-scroll {
  position: relative; /* contains .sr-only labels so they never widen the page */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rr-plans {
  width: 100%;
  border-collapse: collapse;
}
.rr-plans th,
.rr-plans td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rr-border, #c9b98a);
  text-align: left;
  vertical-align: top;
}
.rr-plans thead th { vertical-align: bottom; }
.rr-plans td { text-align: center; width: 22%; }
.rr-plans-col { text-align: center !important; }
.rr-plans-col .pixel { display: block; font-size: 13px; }
/* Column headers sit on the design system's navy .table header; the viewer's own plan is highlighted. */
.rr-plans-col-premium .pixel { color: #d9c2ff; }
.rr-plans thead th.rr-plans-mine { background: #fff6c9; color: var(--rr-ink, #14206b); }
.rr-plans thead th.rr-plans-mine.rr-plans-col-premium .pixel { color: var(--rr-purple, #8a3ffc); }
.rr-plans-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--rr-navy, #1b2a6b);
  color: #fff;
  font-size: 11px;
}
.rr-plans-blurb {
  display: block;
  margin-top: 4px;
  font-weight: normal;
  font-size: 11px;
  line-height: 1.35;
}
.rr-plans-detail {
  display: block;
  font-weight: normal;
  font-size: 11px;
  color: #5b5b6b;
}
.rr-plans-yes { color: #127235; font-weight: bold; font-size: 15px; }
.rr-plans-no { color: #8a8a99; }
.rr-plans-num { font-weight: bold; font-variant-numeric: tabular-nums; }

.rr-premium-steps,
.rr-premium-safety {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 6px;
  line-height: 1.45;
}

.rr-int-catalog { margin: 8px 0 12px; }

.sr-only:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .rr-int-facts { grid-template-columns: minmax(0, 1fr); }
  .rr-int-suggest { align-items: stretch; }
  .rr-plans th,
  .rr-plans td { padding: 6px 4px; }
  .rr-plans-blurb,
  .rr-plans-detail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rr-int *,
  .rr-premium * { transition: none !important; animation: none !important; }
}
