/* PURPOSE: Custom stylesheet for the remote signing demo — token → Web Awesome mapping, workspace grid, step pill, credential cards, document input, and affordances Web Awesome does not provide. */
/* PURPOSE: Paired with tokens.css; wa-card, wa-dialog, wa-drawer, wa-callout inherit WA defaults driven by the token mapping below. */

/* ---------- Token → Web Awesome mapping (per HANDOFF §5) ---------- */

:root {
  --wa-color-brand-fill-loud:       var(--rs-accent);
  --wa-color-brand-fill-loud-hover: var(--rs-accent-hover);
  --wa-color-brand-fill-quiet:      var(--rs-accent-soft);
  --wa-color-neutral-fill-quiet:    var(--rs-surface-2);
  --wa-color-surface-default:       var(--rs-surface);
  --wa-color-surface-raised:        var(--rs-surface);
  --wa-color-border:                var(--rs-border);
  --wa-color-text:                  var(--rs-text);
  --wa-color-text-normal:           var(--rs-text);
  --wa-color-text-quiet:            var(--rs-text-muted);
  --wa-border-radius-m:             var(--rs-radius);
  --wa-font-family-body:            var(--rs-font-sans);
  --wa-font-family-code:            var(--rs-font-mono);
}

/* ---------- Page frame ---------- */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--rs-bg);
  color: var(--rs-text);
  font-family: var(--rs-font-sans, system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.45;
}

body > #app {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ---------- Header ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--rs-space-3, 12px) var(--rs-space-6, 24px);
  background: var(--rs-surface);
  border-bottom: 1px solid var(--rs-border);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3, 12px);
  font-family: var(--rs-font-sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--rs-text);
}

.app-header__brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--rs-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.app-header__brand-name {
  font-weight: 600;
}

.app-header__demo {
  padding: 3px 8px;
  background: var(--rs-accent-soft);
  color: var(--rs-accent-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-radius: 4px;
  text-transform: uppercase;
  line-height: 1.2;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3, 12px);
  color: var(--rs-text-muted);
  font-size: 13px;
  font-family: var(--rs-font-sans);
}

.app-header__user #login-section {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3, 12px);
}

#login-status {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.app-header__user-name {
  color: var(--rs-text);
  font-weight: 500;
}

.app-header__sep {
  color: var(--rs-text-dim);
}

.app-header__expires {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.app-header__expires-label {
  color: var(--rs-text-muted);
}

#token-expires {
  font-variant-numeric: tabular-nums;
  font-family: var(--rs-font-mono);
  font-size: 12px;
  color: var(--rs-text);
}

/* ---------- Step pill (lives inside the content pane) ---------- */

.step-pill {
  display: flex;
  align-items: center;
  gap: var(--rs-space-2, 8px);
  padding: var(--rs-space-3, 12px) var(--rs-space-6, 24px);
  background: transparent;
  border-bottom: 1px solid var(--rs-border);
  overflow-x: auto;
}

.step-pill__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--rs-space-2, 8px);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--rs-surface-3);
  color: var(--rs-text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.step-pill__chip-index {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rs-border);
  color: var(--rs-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.step-pill__sep {
  color: var(--rs-text-dim);
  font-size: 12px;
}

[data-step="1"] .step-pill__chip[data-step-id="1"],
[data-step="2"] .step-pill__chip[data-step-id="2"],
[data-step="3"] .step-pill__chip[data-step-id="3"],
[data-step="4"] .step-pill__chip[data-step-id="4"],
[data-step="5"] .step-pill__chip[data-step-id="5"] {
  background: var(--rs-accent-soft);
  color: var(--rs-accent-ink);
  border-color: var(--rs-accent);
}

[data-step="1"] .step-pill__chip[data-step-id="1"] .step-pill__chip-index,
[data-step="2"] .step-pill__chip[data-step-id="2"] .step-pill__chip-index,
[data-step="3"] .step-pill__chip[data-step-id="3"] .step-pill__chip-index,
[data-step="4"] .step-pill__chip[data-step-id="4"] .step-pill__chip-index,
[data-step="5"] .step-pill__chip[data-step-id="5"] .step-pill__chip-index {
  background: var(--rs-accent);
  color: #fff;
}

[data-step="2"] .step-pill__chip[data-step-id="1"],
[data-step="3"] .step-pill__chip[data-step-id="1"],
[data-step="3"] .step-pill__chip[data-step-id="2"],
[data-step="4"] .step-pill__chip[data-step-id="1"],
[data-step="4"] .step-pill__chip[data-step-id="2"],
[data-step="4"] .step-pill__chip[data-step-id="3"],
[data-step="5"] .step-pill__chip[data-step-id="1"],
[data-step="5"] .step-pill__chip[data-step-id="2"],
[data-step="5"] .step-pill__chip[data-step-id="3"],
[data-step="5"] .step-pill__chip[data-step-id="4"] {
  background: var(--rs-surface);
  color: var(--rs-text-muted);
  border-color: var(--rs-border);
}

[data-step="2"] .step-pill__chip[data-step-id="1"] .step-pill__chip-index,
[data-step="3"] .step-pill__chip[data-step-id="1"] .step-pill__chip-index,
[data-step="3"] .step-pill__chip[data-step-id="2"] .step-pill__chip-index,
[data-step="4"] .step-pill__chip[data-step-id="1"] .step-pill__chip-index,
[data-step="4"] .step-pill__chip[data-step-id="2"] .step-pill__chip-index,
[data-step="4"] .step-pill__chip[data-step-id="3"] .step-pill__chip-index,
[data-step="5"] .step-pill__chip[data-step-id="1"] .step-pill__chip-index,
[data-step="5"] .step-pill__chip[data-step-id="2"] .step-pill__chip-index,
[data-step="5"] .step-pill__chip[data-step-id="3"] .step-pill__chip-index,
[data-step="5"] .step-pill__chip[data-step-id="4"] .step-pill__chip-index {
  background: var(--rs-success);
  color: #fff;
}

/* ---------- Workspace grid (header + body, borderless zones differentiated by bg color) ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  align-items: stretch;
  align-content: stretch;
  gap: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  background: var(--rs-bg);
}

.pane {
  min-width: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.pane--credentials {
  background: var(--rs-surface-2);
  border-right: 1px solid var(--rs-border);
  padding: var(--rs-space-5, 20px) var(--rs-space-4, 16px);
}

.pane--workflow {
  background: var(--rs-bg);
  display: flex;
  flex-direction: column;
}

.workflow-header {
  padding: var(--rs-space-5, 20px) var(--rs-space-6, 24px);
  background: var(--rs-surface);
  border-bottom: 1px solid var(--rs-border);
}

.workflow-header__title {
  margin: 0 0 4px 0;
  font-size: var(--rs-fs-h1, 22px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--rs-text);
}

.workflow-header__subtitle {
  font-size: var(--rs-fs-sm, 12.5px);
  color: var(--rs-text-muted);
  overflow-wrap: anywhere;
}

.workflow-header__callout {
  display: block;
  margin-top: var(--rs-space-3, 12px);
}

.workflow-body {
  padding: var(--rs-space-5, 20px) var(--rs-space-6, 24px);
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-4, 16px);
}

#signing-form {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-4, 16px);
}

.workflow-card {
  background: var(--rs-surface);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius, 10px);
  box-shadow: var(--rs-shadow-sm);
  min-width: 0;
}

.workflow-card__title {
  margin: 0;
  padding: var(--rs-space-3, 12px) var(--rs-space-4, 16px);
  font-size: var(--rs-fs-xs, 11px);
  font-weight: 600;
  color: var(--rs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--rs-border);
}

.workflow-card__body {
  padding: var(--rs-space-4, 16px);
}

.workflow-card--collapsible > .workflow-card__summary {
  cursor: pointer;
  /* display: block on the summary suppresses Chrome's built-in details
     chevron that would otherwise render as an implicit flex child when
     display: flex is used. */
  display: block;
  list-style: none;
}

.workflow-card--collapsible > .workflow-card__summary::-webkit-details-marker {
  display: none;
}

.workflow-card--collapsible > .workflow-card__summary::before {
  content: "▸ ";
  color: var(--rs-text-muted);
  font-size: 10px;
  margin-right: 4px;
}

.workflow-card--collapsible[open] > .workflow-card__summary::before {
  content: "▾ ";
}

.workflow-card--collapsible:not([open]) > .workflow-card__summary {
  border-bottom: none;
}

.workflow__actions {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  margin-top: 0;
}

.pane__title {
  margin: 0 0 var(--rs-space-4, 16px) 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--rs-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pane__empty {
  color: var(--rs-text-muted);
  font-size: 14px;
  padding: var(--rs-space-6, 24px) 0;
  text-align: center;
}

/* ---------- Error container (inside content pane, above workflow body) ---------- */

#error-container {
  padding: 0 var(--rs-space-6, 24px);
}

#error-container:empty {
  padding: 0;
}

#error-container:not(:empty) {
  padding-top: var(--rs-space-3, 12px);
}

/* ---------- Credential cards ---------- */

.cred-list {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-3, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cred-card {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-2, 8px);
  padding: var(--rs-space-4, 16px);
  background: var(--rs-surface);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius, 10px);
  cursor: pointer;
  transition: border-color var(--rs-dur-fast, 120ms) var(--rs-ease-out),
              box-shadow var(--rs-dur-fast, 120ms) var(--rs-ease-out);
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}

.cred-card:hover {
  border-color: var(--rs-border-strong);
  box-shadow: var(--rs-shadow-sm);
}

.cred-card--selected,
.cred-card--selected:hover {
  border-color: var(--rs-accent);
  box-shadow: 0 0 0 2px var(--rs-accent-soft);
}

.cred-card--expired {
  opacity: 0.7;
}

.cred-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rs-space-2, 8px);
}

.cred-card__id {
  font-weight: 600;
  font-size: var(--rs-fs-md, 13.5px);
  color: var(--rs-text);
  word-break: break-all;
}

.cred-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rs-space-2, 8px);
  align-items: center;
  font-size: var(--rs-fs-sm, 12.5px);
  color: var(--rs-text-muted);
}

.cred-card__subject {
  color: var(--rs-text-muted);
  font-size: var(--rs-fs-sm, 12.5px);
  word-break: break-word;
}

.cred-list__loading,
.cred-list__empty {
  color: var(--rs-text-muted);
  font-size: 13px;
  padding: var(--rs-space-4, 16px) 0;
}

/* ---------- Selected-credential summary ---------- */

.workflow__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rs-space-3, 12px);
  padding: var(--rs-space-3, 12px) var(--rs-space-4, 16px);
  background: var(--rs-surface-3);
  border-radius: var(--rs-radius-sm, 6px);
  font-size: var(--rs-fs-sm, 12.5px);
  color: var(--rs-text-muted);
}

.workflow__summary strong {
  color: var(--rs-text);
  font-weight: 600;
}

/* ---------- Document input + segmented control ---------- */

.doc-input {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-3, 12px);
  margin-top: var(--rs-space-4, 16px);
}

.doc-input__label {
  font-size: var(--rs-fs-sm, 12.5px);
  font-weight: 600;
  color: var(--rs-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-input__pane {
  display: none;
}

.doc-input__pane--active {
  display: block;
}

.doc-input__file {
  font: inherit;
}

.hash-preview {
  display: none;
  padding: var(--rs-space-3, 12px) var(--rs-space-4, 16px);
  background: var(--rs-surface-2);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm, 6px);
  font-family: var(--rs-font-mono);
  font-size: var(--rs-fs-sm, 12.5px);
  word-break: break-all;
}

.hash-preview--visible {
  display: block;
}

.hash-preview__label {
  font-size: var(--rs-fs-xs, 11px);
  font-weight: 600;
  color: var(--rs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  display: block;
  font-family: var(--rs-font-sans);
}

/* ---------- Advanced disclosure ---------- */

.advanced {
  background: var(--rs-surface-2);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm, 6px);
}

.advanced > summary {
  padding: var(--rs-space-3, 12px) var(--rs-space-4, 16px);
  cursor: pointer;
  font-size: var(--rs-fs-sm, 12.5px);
  font-weight: 600;
  color: var(--rs-text);
  display: block;
  list-style: none;
}

.advanced > summary::-webkit-details-marker,
.advanced > summary::marker {
  display: none;
  content: "";
}

.advanced > summary::before {
  content: "▸ ";
  color: var(--rs-text-muted);
  display: inline-block;
  width: 1em;
}

.advanced[open] > summary::before {
  content: "▾ ";
}

.advanced__body {
  padding: 0 var(--rs-space-4, 16px) var(--rs-space-4, 16px);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px var(--rs-space-3, 12px);
  font-size: var(--rs-fs-sm, 12.5px);
}

.advanced__body dt {
  color: var(--rs-text-muted);
  font-weight: 500;
}

.advanced__body dd {
  margin: 0;
  font-family: var(--rs-font-mono);
  color: var(--rs-text);
  word-break: break-all;
}

/* ---------- Primary button row ---------- */

.workflow__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--rs-space-4, 16px);
}

/* ---------- Expired / error callout spacing ---------- */

#expired-callout,
#error-container wa-callout {
  margin-bottom: var(--rs-space-3, 12px);
}

/* ---------- Signing form (workflow right pane) ---------- */

#signing-form {
  display: none;
}

#signing-form.signing-form--active {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-3, 12px);
}

/* Post-sign action row is a sibling of the result card, mirroring the pre-sign
 * action row's placement under the input cards. Hidden by default; revealed when
 * `signing-form--show-result` is set. */
#signing-form > .workflow__actions--post-sign {
  display: none;
}

/* When a signature is rendered, suppress the pre-signature workflow cards
 * (document input, advanced parameters, the pre-sign action row) so only the
 * result card + the post-sign action row remain visible. resetToIdle() removes
 * this class to restore the editing view. */
#signing-form.signing-form--show-result > section.workflow-card,
#signing-form.signing-form--show-result > details.workflow-card,
#signing-form.signing-form--show-result > .workflow__actions:not(.workflow__actions--post-sign) {
  display: none;
}

#signing-form.signing-form--show-result > .workflow__actions--post-sign {
  display: flex;
}

#signing-form label {
  font-size: var(--rs-fs-sm, 12.5px);
  color: var(--rs-text-muted);
}

/* ---------- OTP dialog ---------- */

.otp-dialog__hint {
  margin: 0 0 var(--rs-space-4, 16px) 0;
  color: var(--rs-text-muted);
  font-size: var(--rs-fs-sm, 12.5px);
}

.otp-dialog__note {
  margin-bottom: var(--rs-space-4, 16px);
  font-size: var(--rs-fs-sm, 12.5px);
}

.otp-boxes {
  display: flex;
  gap: var(--rs-space-2, 8px);
  justify-content: center;
  margin-bottom: var(--rs-space-4, 16px);
}

.otp-boxes__cell {
  width: 46px;
}

.otp-boxes__cell::part(base) {
  text-align: center;
}

.otp-boxes__cell::part(input) {
  text-align: center;
  font-family: var(--rs-font-mono);
  font-size: var(--rs-fs-lg, 15px);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.otp-dialog__error {
  margin-top: var(--rs-space-3, 12px);
}

.otp-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--rs-space-2, 8px);
}

/* ---------- Signing overlay ---------- */

.signing-overlay__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rs-space-4, 16px);
  padding: var(--rs-space-6, 24px) var(--rs-space-4, 16px);
}

.signing-overlay__spinner {
  font-size: 2rem;
}

.signing-overlay__message {
  margin: 0;
  font-size: var(--rs-fs-md, 13.5px);
  color: var(--rs-text);
}

/* ---------- Inline sign-result card (shown below Autorizovat a podepsat) ---------- */

.sign-result {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-3, 12px);
  margin-top: var(--rs-space-4, 16px);
  padding: var(--rs-space-4, 16px);
  background: var(--rs-surface);
  border: 1px solid var(--rs-success);
  border-left-width: 4px;
  border-radius: var(--rs-radius, 10px);
  box-shadow: var(--rs-shadow-sm);
  min-width: 0;
}

.sign-result__head {
  display: flex;
  align-items: center;
  gap: var(--rs-space-2, 8px);
  font-weight: 600;
  font-size: var(--rs-fs-md, 13.5px);
}

.sign-result__badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--rs-success-soft);
  color: var(--rs-success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sign-result__title {
  font-weight: 600;
  font-size: var(--rs-fs-md, 13.5px);
}

.sign-result__summary {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--rs-space-3, 12px);
  row-gap: 2px;
  margin: 0;
  font-size: var(--rs-fs-sm, 12.5px);
}

.sign-result__summary dt {
  color: var(--rs-text-muted);
  font-weight: 500;
}

.sign-result__summary dd {
  margin: 0;
  color: var(--rs-text);
  overflow-wrap: anywhere;
  min-width: 0;
}

.sign-result__hash {
  font-family: var(--rs-font-mono);
  font-size: var(--rs-fs-xs, 11px);
}

.sign-result__signature {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--rs-space-2, 8px) var(--rs-space-3, 12px);
  background: var(--rs-surface-2);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-sm, 6px);
  min-width: 0;
}

.sign-result__signature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rs-space-2, 8px);
}

.sign-result__signature-label {
  font-size: var(--rs-fs-xs, 11px);
  color: var(--rs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.sign-result__signature-value {
  margin: 0;
  font-family: var(--rs-font-mono);
  font-size: var(--rs-fs-xs, 11px);
  line-height: 1.35;
  color: var(--rs-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  max-height: 120px;
  overflow-y: auto;
  min-width: 0;
}

.sign-result__tech-sad {
  font-family: var(--rs-font-mono);
  font-size: var(--rs-fs-xs, 11px);
  overflow-wrap: anywhere;
  word-break: break-all;
}

.sign-result__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rs-space-3, 12px);
}

.sign-result__tech {
  flex: 1;
  min-width: 0;
}

/* ---------- Header right-side cluster + docs link ---------- */

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--rs-space-4, 16px);
}

.app-header__docs-link {
  color: var(--rs-text-muted);
  font-family: var(--rs-font-sans);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--rs-radius-sm, 6px);
  transition: background var(--rs-dur-fast, 120ms) var(--rs-ease-out),
              color var(--rs-dur-fast, 120ms) var(--rs-ease-out);
}

.app-header__docs-link:hover,
.app-header__docs-link:focus-visible {
  background: var(--rs-surface-3);
  color: var(--rs-text);
}

/* ---------- Docs shell (hub + manual pages) ---------- */

.docs-shell {
  min-height: 100vh;
  background: var(--rs-bg);
  color: var(--rs-text);
  font-family: var(--rs-font-sans);
}

.app-header__brand-link {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3, 12px);
  color: inherit;
  text-decoration: none;
}

.docs-nav {
  display: flex;
  align-items: center;
  gap: var(--rs-space-3, 12px);
  font-size: 13px;
}

.docs-nav__item {
  color: var(--rs-text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--rs-radius-sm, 6px);
}

.docs-nav__item:hover,
.docs-nav__item:focus-visible {
  background: var(--rs-surface-3);
  color: var(--rs-text);
}

.docs-nav__current {
  color: var(--rs-text-dim);
  font-style: italic;
  padding: 6px 4px;
}

.docs-main {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--rs-space-8, 32px) var(--rs-space-6, 24px);
}

.docs-hero {
  margin-bottom: var(--rs-space-8, 32px);
}

.docs-hero h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--rs-space-3, 12px);
  color: var(--rs-text);
}

.docs-hero__lead {
  font-size: 16px;
  line-height: 1.55;
  color: var(--rs-text-muted);
  margin: 0;
  max-width: 65ch;
}

.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--rs-space-5, 20px);
}

.docs-card {
  display: flex;
  flex-direction: column;
}

.docs-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--rs-space-3, 12px);
}

.docs-card__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--rs-text);
  letter-spacing: -0.01em;
}

.docs-card__description {
  font-size: 14px;
  line-height: 1.55;
  color: var(--rs-text-muted);
  margin: 0;
}

.docs-card__footer {
  display: flex;
  gap: var(--rs-space-2, 8px);
  flex-wrap: wrap;
}

.docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rs-space-3, 12px);
  margin-bottom: var(--rs-space-5, 20px);
}

.docs-back {
  color: var(--rs-text-muted);
  text-decoration: none;
  font-size: 13px;
}

.docs-back:hover,
.docs-back:focus-visible {
  color: var(--rs-text);
}

.docs-article {
  background: var(--rs-surface);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-lg, 14px);
  box-shadow: var(--rs-shadow-sm);
  padding: var(--rs-space-8, 32px) clamp(20px, 4vw, 48px);
}

/* ---------- Markdown body typography ---------- */

.markdown {
  color: var(--rs-text);
  font-family: var(--rs-font-sans);
  font-size: 15px;
  line-height: 1.7;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  color: var(--rs-text);
  letter-spacing: -0.01em;
  margin-top: var(--rs-space-8, 32px);
  margin-bottom: var(--rs-space-3, 12px);
  line-height: 1.25;
}

.markdown h1:first-child,
.markdown h2:first-child,
.markdown h3:first-child {
  margin-top: 0;
}

.markdown h1 { font-size: 28px; font-weight: 700; }
.markdown h2 {
  font-size: 22px;
  font-weight: 600;
  padding-bottom: var(--rs-space-2, 8px);
  border-bottom: 1px solid var(--rs-border);
}
.markdown h3 { font-size: 18px; font-weight: 600; }
.markdown h4 { font-size: 16px; font-weight: 600; color: var(--rs-text-muted); }

.markdown p,
.markdown ul,
.markdown ol {
  margin: 0 0 var(--rs-space-4, 16px);
}

.markdown ul,
.markdown ol {
  padding-left: 1.5em;
}

.markdown li + li {
  margin-top: 4px;
}

.markdown a {
  color: var(--rs-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.markdown a:hover,
.markdown a:focus-visible {
  color: var(--rs-accent-hover);
}

.markdown code {
  font-family: var(--rs-font-mono);
  font-size: 0.92em;
  background: var(--rs-surface-3);
  padding: 1px 5px;
  border-radius: 4px;
}

.markdown pre {
  background: var(--rs-surface-2);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius, 10px);
  padding: var(--rs-space-4, 16px);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 var(--rs-space-4, 16px);
}

.markdown pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.markdown blockquote {
  margin: 0 0 var(--rs-space-4, 16px);
  padding: var(--rs-space-3, 12px) var(--rs-space-4, 16px);
  background: var(--rs-accent-soft);
  border-left: 3px solid var(--rs-accent);
  border-radius: var(--rs-radius-sm, 6px);
  color: var(--rs-text);
}

.markdown blockquote p:last-child { margin-bottom: 0; }

.markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--rs-space-5, 20px);
  font-size: 14px;
}

.markdown table th,
.markdown table td {
  border: 1px solid var(--rs-border);
  padding: var(--rs-space-2, 8px) var(--rs-space-3, 12px);
  text-align: left;
  vertical-align: top;
}

.markdown table th {
  background: var(--rs-surface-2);
  font-weight: 600;
  color: var(--rs-text);
}

.markdown table tbody tr:nth-child(2n) {
  background: var(--rs-surface-2);
}

.markdown hr {
  border: none;
  border-top: 1px solid var(--rs-border);
  margin: var(--rs-space-8, 32px) 0;
}
