/* ============================================================
   PASSAGE by Khoshà — stripepay.css
   Styles for the Settings -> Payments screen (stripepay.js) and the
   "Card payment link" panel it adds to the invoice modal.

   Only the bits the shared component classes in styles.css don't
   already cover (.panel, .panel-title, .btn, .pill, .hint, .t-sub).
   Mobile-first: every rule below is the 390px phone layout and the
   only media query widens it. Inputs are 16px so iOS Safari never
   zooms on focus.
   ============================================================ */

.sp-root { display: block; }

.sp-panel { margin-bottom: 16px; }

.sp-lede {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0 0 14px;
}

/* ---------- the connection state card ---------- */

.sp-state {
  background: var(--bone);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-md);
  padding: 16px;
}
.sp-state-ok { background: rgba(30, 58, 51, .05); border-color: rgba(30, 58, 51, .18); }
.sp-state-warn { background: rgba(169, 130, 76, .08); border-color: rgba(169, 130, 76, .3); }

.sp-state-t {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.sp-state-b {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 14px;
}
.sp-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

/* Label/value pairs stack on a phone and never force a sideways scroll:
   a Stripe account id is long and unbreakable-looking, so it is allowed
   to wrap mid-string rather than push the page wide. */
.sp-kv { display: grid; gap: 10px; }
.sp-kv > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sp-kv span {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.sp-kv b {
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.sp-actions .btn { min-height: 40px; }

.sp-note {
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.sp-note-warn {
  background: rgba(169, 130, 76, .1);
  border: 1px solid rgba(169, 130, 76, .3);
  color: var(--gold-deep);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.sp-mini { font-size: 13px; color: var(--ink-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- connecting: the key form and its instructions ----------

   Everything below is the 390px phone layout first. The two hazards on
   a phone are (a) a 100-character key in a text box and (b) the webhook
   URL, both of which are unbreakable-looking strings that will push the
   page sideways if left alone. Every one of them is either a full-width
   input (which cannot overflow) or carries overflow-wrap: anywhere. */

/* "A test key is the safe way to try this" — the single most useful
   sentence on the screen, so it gets its own block rather than being a
   line of small grey text nobody reads. */
.sp-safe {
  margin: 14px 0;
  padding: 12px 13px;
  border-radius: var(--r-sm);
  background: rgba(30, 58, 51, .07);
  border: 1px solid rgba(30, 58, 51, .2);
  color: var(--green);
  font-size: 13px;
  line-height: 1.6;
}
.sp-safe code, .sp-state code, .sp-steps code, .sp-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .93em;
  background: rgba(26, 27, 24, .06);
  padding: 1px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.sp-howto { margin: 16px 0 4px; }
.sp-howto-t {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 8px;
}
.sp-steps-do { color: var(--ink); }
.sp-steps-do li { margin-bottom: 6px; }
.sp-note-quiet {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
}

/* ---------- the form ---------- */

.sp-form { margin-top: 16px; }
.sp-field { margin-bottom: 14px; }
.sp-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
}
.sp-optional {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* The input and its Show button stack on a phone: side by side, a
   password field narrow enough to fit a 44px button beside it at 390px
   is too narrow to see a key in. */
.sp-inputrow { display: flex; flex-direction: column; gap: 8px; }
.sp-input {
  width: 100%;
  min-width: 0;
  font-size: 16px;               /* 16px: stops iOS Safari zooming on focus */
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .01em;
}
.sp-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(169, 130, 76, .16);
}
.sp-inputrow .btn { min-height: 40px; align-self: flex-start; }

/* ---------- the verdict: what Stripe actually said ---------- */

.sp-result:empty { display: none; }
.sp-verdict {
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.sp-verdict-ok {
  background: rgba(30, 58, 51, .08);
  border: 1px solid rgba(30, 58, 51, .25);
  color: var(--green);
}
.sp-verdict-bad {
  background: rgba(140, 59, 46, .07);
  border: 1px solid rgba(140, 59, 46, .28);
  color: var(--red);
}
.sp-verdict-t { font-weight: 700; margin-bottom: 4px; }
.sp-verdict-b { color: var(--ink); }
/* The instruction is the part that actually helps, so it is not smaller
   or greyer than the error it explains. */
.sp-verdict-h {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(140, 59, 46, .22);
  color: var(--ink);
}

/* ---------- folds and the Connect footnote ---------- */

.sp-fold {
  margin-top: 16px;
  border-top: 1px solid var(--stroke-soft);
  padding-top: 12px;
}
.sp-fold > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-deep);
  list-style: none;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-fold > summary::-webkit-details-marker { display: none; }
.sp-fold > summary::before { content: '＋'; font-weight: 700; }
.sp-fold[open] > summary::before { content: '－'; }

.sp-alt {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke-soft);
}
.sp-alt-t { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.sp-alt-b { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 10px; }

/* The webhook address. It must be READABLE in full on a 390px phone, so
   it wraps rather than sitting in a text input that would truncate it —
   and it wraps anywhere, so a long host name still cannot push the page
   sideways. */
.sp-urlrow {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 6px;
}
.sp-urlbox {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
}
.sp-urlrow .btn { flex: 0 0 auto; min-height: 38px; }

/* ---------- recent card payments ---------- */

.sp-pay-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }

.sp-pay {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--stroke-soft);
}
.sp-pay:last-child { border-bottom: 0; }
.sp-pay-main { min-width: 0; flex: 1; }
.sp-pay-main b { font-size: 13.5px; overflow-wrap: anywhere; }
.sp-pay-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.sp-pay-amt { font-weight: 700; font-size: 14px; color: var(--gold-deep); white-space: nowrap; }

/* ---------- "how a client pays" ---------- */

.sp-steps {
  margin: 0 0 4px;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}
.sp-steps li { margin-bottom: 3px; }
.sp-steps b { color: var(--ink); }

/* ---------- the invoice modal panel ---------- */

.sp-inv-panel {
  background: var(--bone);
  margin-top: 14px;
  margin-bottom: 14px;
}

/* The URL is long. On a phone it stacks above its Copy button rather
   than squeezing both onto one line and overflowing the modal. */
.sp-linkrow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.sp-linkbox {
  width: 100%;
  min-width: 0;
  font-size: 16px;               /* 16px: stops iOS Safari zooming on focus */
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  text-overflow: ellipsis;
}
.sp-linkrow .btn { min-height: 44px; }

.sp-settings-block { margin-top: 16px; }

@media (min-width: 560px) {
  .sp-kv { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
  .sp-linkrow { flex-direction: row; align-items: center; }
  .sp-linkrow .btn { flex: 0 0 auto; }
  .sp-inputrow { flex-direction: row; align-items: center; }
  .sp-inputrow .btn { flex: 0 0 auto; align-self: auto; min-height: 46px; }
}

/* The Connect option when the platform isn't registered yet. It used to render
   nothing at all, which left the owner asking why he couldn't connect. */
.sp-alt-off { opacity: .95; border-style: dashed; }
.sp-steps { margin-top: 10px; font-size: 12.5px; line-height: 1.7; }
.sp-steps ol { margin: 6px 0 8px 18px; padding: 0; }
.sp-steps li { margin-bottom: 4px; }
.sp-steps code {
  background: var(--bone,#F4F0E9); border-radius: 4px; padding: 1px 5px;
  font-size: 11.5px; overflow-wrap: anywhere;
}
.sp-alt-note {
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid var(--stroke-soft,rgba(26,27,24,.1));
  font-size: 12.5px; line-height: 1.6; color: var(--gold-deep,#8A6634);
}
@media (max-width: 640px){ .sp-steps ol { margin-left: 15px; } }
