/*
 * The integrations hub. Deliberately small: one screen whose entire job is getting an
 * account connected and then showing, honestly, what that account produced.
 */

.hub-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.hub-brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.hub-main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1.25rem 5rem; }
.hub-loading { color: var(--muted); }

/*
 * app.css styles bare `h2` as a section eyebrow — 12.5px, uppercase, muted. That is the
 * right style for "Available" and the wrong one for a page headline, so the headline gets
 * its own class instead of borrowing a heading level for its looks.
 */
.hub-title {
  font-family: var(--font-display); font-size: 1.65rem; font-weight: var(--display-weight);
  letter-spacing: var(--display-spacing); margin: .25rem 0 .35rem;
}
.hub-lede { color: var(--muted); margin: 0 0 1.75rem; max-width: 42rem; }
/*
 * `--faint` is a 3.3:1 colour on this background — fine for a hairline, not for 11px type.
 * Every small label here uses `--muted` (7:1) instead; uppercase micro-type is the last
 * place to spend contrast.
 */
.hub-eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; margin: 1.75rem 0 .6rem;
}

/* ---------------------------------------------------------------- signed out */

.hub-main-centred { display: grid; place-items: center; min-height: calc(100dvh - 12rem); }
.splash { text-align: center; max-width: 26rem; }
.splash-mark { display: block; margin: 0 auto 1rem; }
.splash-title {
  font-family: var(--font-display); font-size: 1.9rem; font-weight: var(--display-weight);
  letter-spacing: var(--display-spacing); margin: 0 0 .2rem;
}
.splash-sub { color: var(--muted); margin: 0 0 1.5rem; }
.splash-note { color: var(--muted); font-size: .8rem; line-height: 1.5; margin: 1.25rem 0 0; }

/* ---------------------------------------------------------------- nothing connected */

.panel-cta {
  border: var(--panel-border); border-radius: var(--radius); background: var(--panel);
  padding: 2.25rem 1.5rem; text-align: center;
}
.cta-title {
  font-size: 1.05rem; font-weight: 600; margin: 0 0 .5rem;
  text-transform: none; letter-spacing: normal; color: var(--ink);
}
.cta-sub { color: var(--muted); font-size: .9rem; margin: 0 auto 1.25rem; max-width: 30rem; }

.provider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; }
/*
 * `color` is set explicitly: `font: inherit` does not carry colour, so a <button> falls back
 * to the UA's ButtonText — black, on a near-black panel, at 1.1:1.
 */
.provider {
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  border: var(--panel-border); border-radius: var(--radius); background: var(--panel);
  padding: .8rem .9rem; display: grid; gap: .15rem;
}
.provider:hover { border-color: var(--accent); }
.provider-name { font-weight: 600; font-size: .9rem; }
.provider-caps { color: var(--muted); font-size: .8rem; }

/* Dimming with `opacity` scales the text's contrast down with it. The "not yet" reading
   comes from the dashed border and the muted colour, both of which stay legible. */
.provider-soon { cursor: default; border-style: dashed; }
.provider-soon .provider-name { color: var(--muted); }
.provider-soon:hover { border-color: var(--line); }

/* ---------------------------------------------------------------- consent step */

.consent {
  border: var(--panel-border); border-radius: var(--radius); background: var(--panel);
  color: var(--ink); padding: 1.5rem; max-width: 34rem; width: calc(100vw - 2.5rem);
}
.consent::backdrop { background: rgb(0 0 0 / .55); }
.consent-title {
  font-size: 1.15rem; font-weight: 600; margin: 0 0 .4rem;
  text-transform: none; letter-spacing: normal; color: var(--ink);
}
.consent-sub { color: var(--muted); font-size: .875rem; margin: 0 0 .25rem; }

/*
 * Left-aligned on purpose. Centred text turns a scannable list into four ragged blocks,
 * and this is the one list on the site that has to be read rather than glanced at.
 */
.scope-list { list-style: none; margin: .5rem 0 1.25rem; padding: 0; display: grid; gap: 0; }
.scope-list li { display: grid; gap: .1rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.scope-title { font-weight: 600; font-size: .9rem; }
.scope-why { color: var(--muted); font-size: .85rem; }
/* Scope URLs are long and unbreakable; without this the dialog scrolls sideways on a phone. */
.scope-raw { color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }

.consent-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.consent-err { margin: 0 0 .75rem; }

.conn {
  border: var(--panel-border); border-radius: var(--radius); background: var(--panel);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.conn-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.conn-name { font-weight: 600; }
.conn-reason { color: var(--bad); font-size: .875rem; margin: .5rem 0 0; }
.conn-fix { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }

/* Pipeline row: the funnel, not a tick. */
.pipe { border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .9rem; }
.pipe-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.pipe-cap { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }

.stages { display: flex; align-items: stretch; gap: 0; margin-top: .7rem; overflow-x: auto; padding-bottom: .25rem; }
.stage {
  flex: 1 0 6.5rem; border: 1px solid var(--line); border-radius: 6px;
  padding: .5rem .6rem; background: var(--bg);
}
.stage + .stage { margin-left: 1.15rem; position: relative; }
.stage + .stage::before {
  content: ""; position: absolute; left: -1.1rem; top: 50%; width: 1.05rem;
  border-top: 2px solid var(--line);
}
.stage-name { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stage-out { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stage-note { font-size: .72rem; color: var(--muted); }
.stage[data-status="failed"] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 9%, var(--bg)); }
.stage[data-status="failed"] .stage-out,
.stage[data-status="failed"] .stage-note { color: var(--bad); }

/* Never ran, because something upstream stopped. Distinct from "ran and produced nothing":
   the dashes look the same, so the note carries the difference. */
.stage[data-status="blocked"] { border-style: dashed; }
.stage[data-status="blocked"] .stage-out { color: var(--faint); }
.stage[data-status="pending"] .stage-out { color: var(--faint); }

/* ---------------------------------------------------------------- failures

   One block, under the stage row it belongs to. What happened, what to do, and the raw text
   folded away — a response body pasted at full width is a log, not a product. */

.failure {
  margin-top: .8rem; padding: .8rem .9rem; border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line));
  background: color-mix(in srgb, var(--bad) 7%, var(--panel));
}
.failure-head { margin: 0; font-weight: 600; font-size: .875rem; color: var(--ink); }
.failure-fix { margin: .35rem 0 0; font-size: .875rem; color: var(--muted); }
.failure-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 0; }
.btn-fix { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.failure-raw {
  margin: .75rem 0 0; padding: .6rem .7rem; border-radius: 4px; background: var(--bg);
  color: var(--muted); font-family: var(--font-mono); font-size: .72rem; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14rem; overflow-y: auto;
}

.pill {
  font-size: .72rem; padding: .12rem .5rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.pill[data-state="connected"], .pill[data-state="idle"] { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.pill[data-state="broken"] { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.pill[data-state="degraded"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.pill[data-state="syncing"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.btn {
  font: inherit; font-size: .875rem; padding: .4rem .85rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer;
  display: inline-block; text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-lg { font-size: .95rem; padding: .6rem 1.3rem; }
.btn[disabled] { opacity: .5; cursor: default; }

.run-failure {
  margin: .35rem 0 0; font-size: .85rem; color: var(--bad);
  line-height: 1.5; overflow-wrap: anywhere;
}
.run-failure a { color: var(--accent); }

.locality { margin: .4rem 0 0; font-size: .8rem; color: var(--muted); }
.locality-stale { color: var(--warn); }

.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem 1.25rem; text-align: center; }
.empty h2 { margin: 0 0 .5rem; }
.err { color: var(--bad); font-size: .875rem; }

@media (max-width: 30rem) {
  .stages { gap: 0; }
  .stage { flex-basis: 5.5rem; }
}
