/* CardVault Docs portal -- same design system as the public site
   (dark ledger aesthetic, brand blues, mono for payment-native material). */

:root {
  color-scheme: dark;
  --ink: #070D1A;
  --panel: #0D1526;
  --panel-2: #101A30;
  --line: #1C2A45;
  --line-soft: #14203A;
  --deep: #005697;
  --accent: #2E9BE6;
  --pale: #BFE3FA;
  --text: #E8EEF7;
  --muted: #8FA0BC;
  --good: #3DC98A;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", Consolas, "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--pale); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.microlabel {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 3px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  background: var(--deep);
  color: #fff;
  border: 1px solid var(--accent);
  cursor: pointer;
}
.btn-primary:hover { background: #006AB8; color: #fff; }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.btn-link:hover { color: var(--pale); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 34px 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-brand { display: grid; gap: 10px; margin-bottom: 26px; }
.login-brand svg { height: 20px; width: auto; color: var(--text); }
.login-form { display: grid; gap: 16px; }
.login-sent { color: var(--muted); font-size: 14px; }
.login-sent strong { color: var(--text); }
.login-foot { font-size: 12.5px; color: var(--muted); }
.login-restart { margin-top: 14px; text-align: center; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.field input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
}
.field input:focus { outline: none; border-color: var(--accent); }

.form-error {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #FF6B7A;
  margin-bottom: 16px;
}

/* ---------- topbar ---------- */
.topbar { border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.topbar-inner {
  max-width: 1280px;
  margin-inline: auto;
  padding: 16px clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.nav-logo { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.nav-logo svg { height: 16px; width: auto; display: block; }
.topbar-tag { color: var(--accent); }
.topbar-user { display: flex; align-items: center; gap: 18px; }

/* ---------- shell ---------- */
.shell {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  padding: 0 clamp(16px, 3vw, 32px);
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { border-right: none; border-bottom: 1px solid var(--line-soft); padding-bottom: 20px; }
}

.sidenav {
  padding-block: 32px;
  border-right: 1px solid var(--line-soft);
}
.nav-group { margin-bottom: 26px; }
.nav-group-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 8px;
}
.nav-link {
  display: block;
  padding: 5px 10px;
  margin-left: -10px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 3px;
}
a.nav-link:hover { color: var(--pale); background: var(--panel); }
.nav-link.is-active { color: var(--text); background: var(--panel-2); border-left: 2px solid var(--accent); }
.nav-link.is-soon { cursor: default; }
.nav-link.is-soon em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--line);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
}

/* ---------- doc content ---------- */
.doc-main { padding-block: 36px 72px; max-width: 780px; }
.doc-head { margin-bottom: 34px; }
.doc-head .microlabel { display: block; margin-bottom: 12px; color: var(--accent); }
.doc-head h1 {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.doc-lead { margin-top: 12px; color: var(--muted); font-size: 16px; max-width: 60ch; }

.doc-main h2 { font-size: 19px; font-weight: 600; margin: 34px 0 10px; }
.doc-main p { color: var(--muted); margin-bottom: 12px; max-width: 68ch; }
.doc-main p strong, .doc-main li strong { color: var(--text); }
.doc-main code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 1px 5px;
}

.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-block: 8px 26px;
}
.doc-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  color: inherit;
}
a.doc-card:hover { border-color: var(--accent); color: inherit; }
.doc-card h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.doc-card p { font-size: 13.5px; color: var(--muted); margin: 0; }
.doc-card.is-soon { opacity: 0.55; }

.codeblock {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-block: 14px 20px;
}
.codeblock-head {
  display: flex;
  justify-content: space-between;
  padding: 9px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.codeblock pre {
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text);
}
.codeblock .c { color: var(--muted); }
.codeblock .k { color: var(--accent); }
.codeblock .s { color: var(--pale); }
.codeblock .g { color: var(--good); }

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--panel);
  padding: 14px 18px;
  margin-block: 20px;
  font-size: 14px;
  color: var(--muted);
}
.callout strong { color: var(--text); }
.callout.warn { border-left-color: #E0A83C; }
.callout.info { border-left-color: var(--accent); }

/* ---------- footer ---------- */
.doc-footer { border-top: 1px solid var(--line-soft); }
.doc-footer-inner {
  max-width: 1280px;
  margin-inline: auto;
  padding: 20px clamp(16px, 3vw, 32px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

/* Soft-launch notice (Site.ApiComingSoon, 2026-10-17). */
.coming-soon {
  margin: 0 0 24px;
  padding: 14px 18px;
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 6px;
  background: var(--panel-2);
}
.coming-soon strong { color: var(--pale); }
.coming-soon p { color: var(--muted); margin: 4px 0 0; }

/* ---------- card entry template gallery (/integrations/templates) ----------
   Live previews of the CCE templates on preview-only interfaces. The stage is a light
   "your page" panel: the templates are designed for a tenant's (usually light) checkout,
   and IFRAME 4 is transparent with dark text. */
.tpl-testcards code { white-space: nowrap; }

.tpl-gallery { display: grid; gap: 18px; margin-block: 22px 30px; }
.tpl-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.tpl-card-stage {
  background: #F4F6FA;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.tpl-card-frame { display: block; width: 100%; border: 0; background: transparent; }
.tpl-card-hosted { color: #30313D; padding: 18px 4px; }
.tpl-card-hosted .microlabel { color: #4A5568; }
.tpl-card-hosted p { color: #4A5568; margin: 6px 0 0; font-size: 14px; }
.tpl-card-body { padding: 16px 18px 18px; }
.tpl-card-body h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.tpl-card-body p { font-size: 14px; margin-bottom: 8px; }
.tpl-bestfor { font-size: 13.5px; }
.tpl-badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--good); border: 1px solid var(--good); border-radius: 3px; padding: 1px 6px;
  margin-left: 8px; vertical-align: 2px;
}
.tpl-open { font-weight: 600; font-size: 14px; }

.tpl-controls { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-block: 18px 12px; }
.tpl-control { display: flex; align-items: center; gap: 6px; }
.tpl-control .microlabel { margin-right: 4px; }
.tpl-seg {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-radius: 3px; padding: 4px 10px; font-size: 13px; cursor: pointer; font-family: var(--font-body);
}
.tpl-seg:hover { color: var(--text); }
.tpl-seg.is-on { color: var(--text); border-color: var(--accent); background: var(--panel-2); }

.tpl-stage { border-radius: 6px; padding: 22px; background: #FFFFFF; }
.tpl-stage[data-bg="grey"] { background: #E9EDF3; }
/* Desktop = the full stage width: IFRAME 3 and 4 lay out across the row and wrap or
   truncate when squeezed. Phone = a typical small-screen width. */
.tpl-host { margin: 0 auto; color: #30313D; font-size: 14px; }
.tpl-stage[data-width="phone"] .tpl-host { max-width: 340px; }
.tpl-host-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #6B7280; margin-bottom: 10px;
}
.tpl-order {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0 14px; border-bottom: 1px solid #E3E7EE; margin-bottom: 16px;
}
.tpl-frame-box { position: relative; border: 1px dashed #9AA8BD; border-radius: 6px; padding: 18px 8px 8px; }
.tpl-frame-label {
  position: absolute; top: -9px; left: 10px; padding: 0 6px; background: inherit;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #6B7280;
}
.tpl-stage .tpl-frame-label { background: #FFFFFF; }
.tpl-stage[data-bg="grey"] .tpl-frame-label { background: #E9EDF3; }
#cv-frame iframe { display: block; width: 100%; border: 0; }
.tpl-host-field { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; color: #4A5568; font-size: 13px; }
.tpl-host-field select {
  font-size: 14px; padding: 8px; border: 1px solid #CBD2DC; border-radius: 6px; background: #FFFFFF; color: #30313D;
}
.tpl-pay {
  width: 100%; margin-top: 12px; padding: 12px; border: 0; border-radius: 8px;
  background: #15803D; color: #FFFFFF; font-size: 15px; font-weight: 600; cursor: pointer;
}
.tpl-pay:disabled { opacity: 0.55; cursor: default; }
.tpl-status { margin: 10px 0 0; font-size: 13px; color: #4A5568; min-height: 1.4em; }
.tpl-status.is-ok { color: #15803D; }
.tpl-status.is-bad { color: #B42318; }

.tpl-events { margin-top: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.tpl-events-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 15px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.tpl-events-list { list-style: none; max-height: 420px; overflow-y: auto; }
.tpl-events-list:empty::before {
  content: "No messages yet."; display: block; padding: 14px 15px; color: var(--muted); font-size: 13px;
}
.tpl-event { border-bottom: 1px solid var(--line-soft); padding: 10px 15px; }
.tpl-event-head { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.tpl-event.is-out .tpl-event-head { color: var(--good); }
.tpl-event pre {
  margin-top: 6px; font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.tpl-events-note { font-size: 12.5px; padding: 10px 15px; margin: 0 !important; }

@media (max-width: 640px) {
  .tpl-stage { padding: 14px; }
  .tpl-card-stage { padding: 12px; }
}

/* ---------- JS fields branded showcase (/integrations/templates/jsif) ----------
   A fictional shop page. Its own inputs and the Card Vault card fields share one set of
   values per theme (jsif-showcase.js THEMES); "Outline what Card Vault hosts" marks the
   three card slots. */
.jsx-reveal { cursor: pointer; }
.jsx-reveal input { accent-color: var(--accent); }

.jsx-shop {
  --s-bg: #FBF6EF; --s-panel: #FFFFFF; --s-text: #3B2A1E; --s-muted: #7A6656; --s-line: #E8DCCD;
  --s-input-bg: #FFFFFF; --s-input-border: #D9C7B3; --s-accent: #9A4F1C; --s-ring: rgba(154,79,28,0.18);
  --s-radius: 10px; --s-font: Georgia, "Times New Roman", serif; --s-head: Georgia, "Times New Roman", serif;
  --s-pay-text: #FFFFFF; --s-placeholder: #A08C7A;
  background: var(--s-bg); color: var(--s-text); font-family: var(--s-font);
  border-radius: 6px; padding: 22px; margin-top: 4px;
}
.jsx-shop[data-theme="midnight"] {
  --s-bg: #0F172A; --s-panel: #111C33; --s-text: #E2E8F0; --s-muted: #94A3B8; --s-line: #1E293B;
  --s-input-bg: #0B1222; --s-input-border: #334155; --s-accent: #38BDF8; --s-ring: rgba(56,189,248,0.25);
  --s-radius: 8px; --s-font: "Segoe UI", system-ui, sans-serif; --s-head: "Segoe UI", system-ui, sans-serif;
  --s-pay-text: #0B1222; --s-placeholder: #64748B;
}
.jsx-shop[data-theme="minimal"] {
  --s-bg: #FFFFFF; --s-panel: #FFFFFF; --s-text: #111111; --s-muted: #555555; --s-line: #111111;
  --s-input-bg: #FFFFFF; --s-input-border: #111111; --s-accent: #111111; --s-ring: rgba(17,17,17,0.12);
  --s-radius: 0px; --s-font: Helvetica, Arial, sans-serif; --s-head: Helvetica, Arial, sans-serif;
  --s-pay-text: #FFFFFF; --s-placeholder: #8A8A8A;
}
.jsx-brand { display: flex; align-items: baseline; gap: 8px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--s-line); }
.jsx-logo { font-family: var(--s-head); font-size: 22px; font-weight: 700; color: var(--s-accent); }
.jsx-logo-sub { font-family: var(--s-head); font-size: 16px; color: var(--s-text); }
.jsx-fiction { margin-left: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--s-muted); }
.jsx-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 22px; }
.jsx-form h3, .jsx-summary h3 { font-family: var(--s-head); font-size: 15px; font-weight: 700; color: var(--s-text); margin: 16px 0 8px; }
.jsx-form h3:first-child, .jsx-summary h3:first-child { margin-top: 0; }
.jsx-form h3 small { font-weight: 400; color: var(--s-muted); font-size: 12px; }
.jsx-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; flex: 1 1 0; min-width: 0; }
.jsx-field > span { font-size: 13px; color: var(--s-muted); }
.jsx-field input, .jsx-field select {
  height: 44px; padding: 0 12px; font: 15px var(--s-font); color: var(--s-text);
  background: var(--s-input-bg); border: 1px solid var(--s-input-border); border-radius: var(--s-radius);
  outline: none; width: 100%;
}
.jsx-field input::placeholder { color: var(--s-placeholder); }
.jsx-field input:focus, .jsx-field select:focus { border-color: var(--s-accent); box-shadow: 0 0 0 2px var(--s-ring); }
.jsx-row { display: flex; gap: 10px; }
.jsx-narrow { flex: 0 0 110px; }
.jsx-card-slot { position: relative; min-height: 44px; }
/* The card field document is light-scheme; this site is color-scheme: dark. Browsers paint an
   opaque backdrop behind an iframe whose scheme differs from its embedder's, which shows as
   light corners around a rounded field. Match the frame's scheme so it stays transparent. */
.jsx-card-slot iframe { display: block; color-scheme: light; }
.jsx-shop.is-reveal .jsx-card-slot { outline: 2px dashed #E0A83C; outline-offset: 3px; }
.jsx-shop.is-reveal .jsx-card-slot::after {
  content: "Card Vault"; position: absolute; top: -10px; right: 6px; padding: 0 4px;
  font: 600 9px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: #8A5A00; background: #FFE8B0;
}
.jsx-pay {
  width: 100%; height: 46px; margin-top: 6px; border: 0; border-radius: var(--s-radius);
  background: var(--s-accent); color: var(--s-pay-text); font: 600 15px var(--s-font); cursor: pointer;
}
.jsx-pay:disabled { opacity: 0.55; cursor: default; }
.jsx-status { margin: 10px 0 0 !important; font-size: 13px; color: var(--s-muted) !important; min-height: 1.4em; }
.jsx-status.is-ok { color: #4D7C3A !important; }
.jsx-shop[data-theme="midnight"] .jsx-status.is-ok { color: #34D399 !important; }
.jsx-status.is-bad { color: #C1121F !important; }
.jsx-shop[data-theme="midnight"] .jsx-status.is-bad { color: #F87171 !important; }
.jsx-summary { background: var(--s-panel); border: 1px solid var(--s-line); border-radius: var(--s-radius); padding: 16px; align-self: start; font-size: 14px; }
.jsx-line { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; color: var(--s-text); }
.jsx-total { border-top: 1px solid var(--s-line); margin-top: 6px; padding-top: 10px; font-weight: 700; }

@media (max-width: 760px) {
  .jsx-grid { grid-template-columns: 1fr; }
  .jsx-summary { order: -1; }
  .jsx-row { flex-wrap: wrap; }
  .jsx-narrow { flex: 1 1 100px; }
}
