/* ============================================================
   Gantry — Connect / API / Support styles
   ============================================================ */

.cg-conn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.cg-conn-role-row {
  display: flex;
  gap: 6px;
  padding: 0 0 12px;
}

/* ---- Add/edit wizard (connect-wizard.jsx) — details step ---------------- */
.cg-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.cg-field-req { color: var(--bad); }
.cg-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  font-size: 10.5px;
  color: var(--fg-3);
  cursor: pointer;
}
.cg-help-icon:hover { border-color: var(--brand); color: var(--brand); }
.cg-cred-field { margin-bottom: 14px; }
/* Edit form: the label row carries the optional field's Clear / Undo. */
.cg-cred-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cg-cred-actions { display: inline-flex; align-items: center; gap: 6px; margin-top: -4px; }
.cg-cred-act { padding: 3px 8px; font-size: 12px; }
/* Marked for removal: the empty, dashed field says nothing is kept. */
.cg-cred-field.clearing .cg-input { border-style: dashed; background: var(--bg-2); }
.cg-cred-field.bad .cg-field-label { color: var(--bad); }
.cg-cred-field.bad input,
.cg-cred-field.bad .cg-input {
  border-color: var(--bad) !important;
}
.cg-cap-row {
  display: flex;
  gap: 24px;
  padding: 12px 0 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.cg-cap-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-2);
}

/* ---- Field picker (wizard Fields step + detail drawer Fields tab) ------- */
.cg-field-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px 10px;
}
.cg-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.cg-field-row:last-child { border-bottom: 0; }
.cg-field-row input { accent-color: var(--brand); margin: 0; }
.cg-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 11.5px;
  color: var(--brand);
  cursor: pointer;
  text-decoration: underline;
}
.cg-conn-card {
  padding: 16px;
  cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease), transform .1s var(--ease);
  display: flex; flex-direction: column;
}
.cg-conn-card:hover { background: var(--bg-2); border-color: var(--line-2); }
.cg-conn-card.disabled { opacity: .76; }
.cg-conn-card-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.cg-conn-logo {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600;
  font-size: 14px;
}
.cg-conn-card-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.cg-conn-row {
  display: flex; flex-direction: column; gap: 4px;
}
.cg-conn-card-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
}

/* Drawer (connector instance) */
.cg-drawer-wrap {
  position: fixed; inset: 0; z-index: 200;
  display: flex; justify-content: flex-end;
}
.cg-drawer-scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
}
.cg-drawer {
  position: relative;
  width: min(680px, 96vw);
  height: 100%;
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.cg-drawer-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.cg-drawer-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* Code/schema blocks */
.cg-schema {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
  font-size: 12px;
  color: var(--fg-2);
  white-space: pre;
  overflow-x: auto;
  margin: 0;
  line-height: 1.6;
}

/* ============================================================
   Add / Edit connector — popover wizard
   (.cg-modal-* moved to /ui/components.css on 2026-07-05)
   ============================================================ */

/* Step indicator */
.cg-wizard-steps {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px 0;
}
.cg-wizard-step {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-3);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}
.cg-wizard-step[data-active="true"] {
  color: var(--bg-1);
  background: var(--fg);
  border-color: var(--fg);
}
.cg-wizard-step[data-done="true"] {
  color: var(--good);
  border-color: color-mix(in oklab, var(--good) 40%, var(--line));
}

/* Connector picker list */
.cg-pick-list { display: flex; flex-direction: column; gap: 8px; }
.cg-pick-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  cursor: pointer;
  transition: background .12s var(--ease), border-color .12s var(--ease);
}
.cg-pick-row:hover { background: var(--bg-hover); border-color: var(--line-2); }
.cg-pick-row.disabled { opacity: .55; cursor: not-allowed; }
.cg-pick-row.disabled:hover { background: var(--bg-2); border-color: var(--line); }

/* Copy field (read-only value + copy button) */
.cg-copy-field {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.cg-copy-field .mono { flex: 1; font-size: 12.5px; color: var(--fg-2); }
.cg-copy-field .cg-btn { flex: 0 0 auto; }

/* One-time key reveal (Connect wizard, final screen of the access-key flow).
   The panel draws attention once — a single gold hairline pulse on entry —
   then settles; the copy field is what the customer must act on, so it is the
   only thing that moves. Reduced-motion users get the settled state. */
.cg-key-reveal-head {
  display: flex; align-items: center; gap: 14px;
}
.cg-key-reveal-field {
  border-color: color-mix(in oklab, var(--brand) 55%, var(--line));
  background: color-mix(in oklab, var(--brand) 6%, var(--bg-2));
  animation: cg-key-reveal-in .6s var(--ease) both;
}
.cg-key-reveal-field .mono { color: var(--fg); font-size: 13px; }
@keyframes cg-key-reveal-in {
  0%   { box-shadow: 0 0 0 0 var(--brand-glow); transform: translateY(4px); opacity: 0; }
  60%  { box-shadow: 0 0 0 6px var(--brand-glow); transform: none; opacity: 1; }
  100% { box-shadow: 0 0 0 0 transparent; transform: none; opacity: 1; }
}
.cg-key-reveal-ack {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 16px; padding: 12px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--fg-2);
  cursor: pointer;
}
.cg-key-reveal-ack input { margin-top: 3px; accent-color: var(--brand); }
@media (prefers-reduced-motion: reduce) {
  .cg-key-reveal-field { animation: none; }
}

/* Access-key grant pickers (scopes + expiry) on the wizard's key screen. */
.cg-scope-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}
.cg-scope-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  font-size: 12.5px; color: var(--fg-2);
  cursor: pointer;
  transition: border-color .14s var(--ease), background .14s var(--ease), color .14s var(--ease);
}
.cg-scope-opt:hover { border-color: var(--line-2); background: var(--bg-hover); }
.cg-scope-opt.on {
  color: var(--fg);
  border-color: color-mix(in oklab, var(--brand) 55%, var(--line));
  background: color-mix(in oklab, var(--brand) 7%, var(--bg-2));
}
.cg-scope-opt input { accent-color: var(--brand); margin: 0; }

/* ============================================================
   API access panel (Connect) — the account's request budget and
   every key's own usage underneath it.
   ============================================================ */
.cg-key-headroom { margin-bottom: 12px; }
.cg-key-headroom-num {
  display: flex; align-items: baseline; gap: 8px;
  margin: 10px 0 8px;
}
.cg-key-headroom-big {
  font-family: var(--font-serif);
  font-size: 34px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cg-key-headroom-of { font-size: 12.5px; color: var(--fg-3); }
.cg-key-headroom-track {
  height: 6px; border-radius: var(--r-pill);
  background: var(--bg-3); overflow: hidden;
}
.cg-key-headroom-fill {
  display: block; height: 100%;
  border-radius: var(--r-pill);
  background: var(--good);
  /* Draws in from zero on first paint, then tracks the value. */
  transition: width .9s var(--ease), background .3s var(--ease);
}
.cg-key-headroom-track[data-bucket="warn"] .cg-key-headroom-fill { background: var(--warn); }
.cg-key-headroom-track[data-bucket="bad"]  .cg-key-headroom-fill { background: var(--bad); }
.cg-key-headroom-foot { font-size: 10.5px; color: var(--fg-4); margin-top: 8px; }

.cg-key-list { display: flex; flex-direction: column; gap: 10px; }
.cg-key-row { padding: 14px 16px; }
/* Staggered reveal: rows arrive in order rather than all at once. */
.cg-key-reveal-row { animation: cg-key-row-in .34s var(--ease) both; }
@keyframes cg-key-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.cg-key-row.rotating { border-color: color-mix(in oklab, var(--warn) 45%, var(--line)); }
.cg-key-row.dead { opacity: .6; }
.cg-key-row-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.cg-key-row-name { font-weight: 600; font-size: 14px; }
.cg-key-row-mask { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.cg-key-dim { font-size: 11.5px; color: var(--fg-4); }

.cg-key-scopes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cg-key-scope {
  font-size: 11px; padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-2); color: var(--fg-2);
}
.cg-key-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px 16px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.cg-key-stats .cg-conn-row .mono { font-size: 12px; }
.cg-key-dates {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 10.5px; color: var(--fg-4); margin-top: 10px;
}
.cg-key-expiry-expiring_soon { color: var(--warn); }
.cg-key-expiry-expiring_now { color: var(--bad); font-weight: 600; }

.cg-key-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 10px; padding: 9px 11px;
  border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.5;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-2);
}
.cg-key-note.expiring_soon { border-color: color-mix(in oklab, var(--warn) 40%, var(--line)); }
.cg-key-note.expiring_now  { border-color: color-mix(in oklab, var(--bad)  45%, var(--line)); }
.cg-key-note.rotating      { border-color: color-mix(in oklab, var(--warn) 45%, var(--line)); }
/* A key mid-changeover keeps a slow pulse: it is a state that ends. */
.cg-key-pulse {
  flex: 0 0 auto; width: 8px; height: 8px; margin-top: 5px;
  border-radius: 50%; background: var(--warn);
  animation: cg-key-pulse 2s var(--ease) infinite;
}
@keyframes cg-key-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--warn-glow); opacity: 1; }
  50%      { box-shadow: 0 0 0 5px transparent; opacity: .55; }
}
.cg-key-row-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line);
}
@media (prefers-reduced-motion: reduce) {
  .cg-key-reveal-row { animation: none; }
  .cg-key-pulse { animation: none; }
  .cg-key-headroom-fill { transition: none; }
}

/* A multi-line credential (a pasted private key) keeps its line breaks —
   a single-line input would collapse them and the key would never parse. */
/* A pick-one credential field's per-choice warning (plain FTP is unencrypted). */
.cg-cred-warn {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--warn);
  background: var(--bg-2);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg-2);
}
.cg-cred-textarea { width: 100%; min-height: 110px; resize: vertical; font-family: var(--font-mono); font-size: 12px; line-height: 1.4; }

/* ============================================================
   Support (support.jsx) — two boxes, side by side down to ~720px,
   then stacked so neither ever scrolls horizontally on a phone.
   ============================================================ */
.cg-support-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
  align-items: stretch;
}
@media (max-width: 720px) {
  .cg-support-grid { grid-template-columns: 1fr; }
}
.cg-support-box {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.cg-support-doc-card {
  justify-content: center;
}
.cg-support-contact-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cg-support-contact-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg-3);
}
.cg-support-contact-line a {
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
}
.cg-support-contact-line a:hover { text-decoration: underline; }
.cg-support-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cg-support-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.cg-support-status.success { color: var(--good); }
.cg-support-status.error { color: var(--bad); }
