:root {
  --page-bg-top: #ffffff;
  --page-bg-bottom: #ffffff;
  --page-line: #e5e7eb;
  --primary-color: #f4511e;
  --accent: var(--primary-color);
  --accent-dark: color-mix(in srgb, var(--accent) 75%, black);
  --accent-hover: color-mix(in srgb, var(--accent) 85%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-foreground: #ffffff;
  --yesid-accent-color: var(--accent);
  --yesid-accent-foreground: var(--accent-foreground);
  --doc-scanner-accent: var(--accent);
  --doc-scanner-icon-color: var(--accent);
  --ink: #202124;
  --panel: #ffffff;
  --card: #ffffff;
  --field-border: #dedfe2;
  --field-text: #44474c;
  --label-text: #34363a;
  --muted-text: #686b70;
  --strong-border: #e5e7eb;
  --surface-inset: #ffffff;
  --code-bg: #f7f7f8;
  --code-text: #44474c;
  --chip-bg: #f5f5f5;
  --chip-text: #44474c;
  --sdk-card-bg: #ffffff;
  --shadow-soft: none;
  --result-success: #216e39;
  --result-success-soft: rgba(33, 110, 57, 0.1);
  --result-error: #b42318;
  --result-error-soft: rgba(180, 35, 24, 0.08);
  --result-warning: #854d0e;
  --result-warning-soft: rgba(202, 138, 4, 0.12);
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page-bg-top: #111111;
  --page-bg-bottom: #060606;
  --page-line: rgba(255, 255, 255, 0.08);
  --accent-dark: color-mix(in srgb, var(--accent) 70%, white);
  --accent-hover: color-mix(in srgb, var(--accent) 85%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --ink: #f6f7f9;
  --panel: rgba(20, 22, 25, 0.94);
  --card: #15171a;
  --field-border: #333940;
  --field-text: #e4e7ec;
  --label-text: #f5f7fa;
  --muted-text: #aeb6c2;
  --strong-border: #2a2f36;
  --surface-inset: #101214;
  --code-bg: #1e1e1e;
  --code-text: #d4d4d4;
  --chip-bg: #15171a;
  --chip-text: #d2d8e1;
  --sdk-card-bg: #171a1f;
  --shadow-soft: none;
  --result-success: #9be4a2;
  --result-success-soft: rgba(76, 175, 80, 0.16);
  --result-error: #ffb4a8;
  --result-error-soft: rgba(239, 68, 68, 0.14);
  --result-warning: #ffd28a;
  --result-warning-soft: rgba(245, 158, 11, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg-bottom);
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", "Avenir Next", sans-serif;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.theme-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
  position: relative;
}

.theme-switcher-wrapper {
  position: relative;
  display: inline-block;
}

.theme-toggle,
.theme-toggle-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
  user-select: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible,
.theme-toggle-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle:focus-visible,
.theme-toggle-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 2px;
}

.theme-toggle:active,
.theme-toggle-btn:active {
  transform: translateY(1px);
}

.theme-toggle-btn__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px var(--field-border);
  flex-shrink: 0;
  transition: background-color 160ms ease, transform 160ms ease;
}

.theme-toggle-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.theme-toggle-btn__icon svg {
  width: 100%;
  height: 100%;
}

.theme-toggle-btn__caret {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: transform 160ms ease;
}

.theme-toggle-btn[aria-expanded="true"] .theme-toggle-btn__caret {
  transform: rotate(180deg);
}

/* Popover dialog */
.theme-switcher-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--field-border);
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  color: var(--ink);
  animation: themePopoverFadeIn 160ms ease-out;
}

@media (min-width: 640px) {
  .theme-switcher-popover {
    width: 360px;
    padding: 18px;
  }
}

@keyframes themePopoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.theme-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--strong-border);
}

.theme-popover-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}

.theme-popover-close {
  appearance: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted-text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.theme-popover-close:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.theme-popover-section {
  margin-bottom: 16px;
}

.theme-popover-section:last-child {
  margin-bottom: 0;
}

.theme-popover-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.theme-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-text);
}

.theme-reset-color-btn {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.theme-reset-color-btn:hover {
  opacity: 0.8;
}

/* Mode segmented buttons */
.theme-mode-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--surface-inset, #f3f4f6);
  border: 1px solid var(--field-border);
  border-radius: 10px;
}

.theme-segmented-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.theme-segmented-btn:hover {
  color: var(--ink);
}

.theme-segmented-btn.is-active,
.theme-segmented-btn[aria-checked="true"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.theme-mode-svg {
  width: 14px;
  height: 14px;
}

/* Color palette grid */
.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.theme-color-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 40px;
  border: 2px solid transparent;
  border-radius: 10px;
  background-color: var(--swatch-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  padding: 0;
}

.theme-color-swatch:hover {
  transform: scale(1.08);
}

.theme-color-swatch:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.theme-color-swatch.is-active,
.theme-color-swatch[aria-checked="true"] {
  border-color: var(--card);
  box-shadow: 0 0 0 2px var(--ink);
}

.theme-color-swatch.is-active::after,
.theme-color-swatch[aria-checked="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ffffff;
}

/* Custom Color swatch / input */
.theme-color-swatch-custom {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 40px;
  border: 2px dashed var(--field-border);
  border-radius: 10px;
  background: var(--surface-inset, #f3f4f6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, border-color 140ms ease;
  overflow: hidden;
}

.theme-color-swatch-custom:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}

.theme-color-swatch-custom.is-active {
  border: 2px solid var(--card);
  box-shadow: 0 0 0 2px var(--ink);
}

.theme-custom-color-input {
  position: absolute;
  inset: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  opacity: 0;
  cursor: pointer;
}

.theme-custom-color-ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.theme-active-color-name {
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-text);
  text-align: center;
  min-height: 1.2em;
}

.session-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--strong-border, #e8e8e8);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
}

.session-controls__copy {
  display: grid;
  gap: 4px;
}

.session-controls__title,
.session-controls__hint,
.session-control-status {
  margin: 0;
}

.session-controls__title {
  color: var(--label-text);
  font-weight: 800;
}

.session-controls__hint,
.session-control-status {
  color: var(--muted-text, #6f746d);
  font-size: 0.88rem;
}

.session-controls__actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.session-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.session-config-current {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.4;
  flex: 1 1 200px;
}

.session-config-current__label {
  color: var(--muted-text, #6f746d);
}

.session-config-current__value {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.session-id-field {
  display: grid;
  flex: 1 1 280px;
  min-width: 0;
  gap: 6px;
  color: var(--muted-text, #6f746d);
  font-size: 0.78rem;
  font-weight: 800;
}

.session-id-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.session-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.session-button--secondary {
  background: transparent;
  color: var(--accent-dark);
}

.session-button--compact {
  min-height: 32px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 6px;
  flex-shrink: 0;
}

.session-button:disabled,
.session-id-field input:disabled {
  cursor: wait;
  opacity: 0.6;
}

.session-control-status.is-success {
  color: #16803c;
}

.session-control-status.is-error {
  color: #dc2626;
}

.capture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 24px;
  margin-bottom: 32px;
}

.action-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--strong-border, #e8e8e8);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.action-card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.document-type-card {
  display: none;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 106, 47, 0.28);
  border-radius: 12px;
  background: var(--accent-soft);
}

.document-type-card.is-visible {
  display: grid;
}

.document-type-card.needs-selection {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 81, 30, 0.14);
}

.document-type-card__title {
  margin: 0;
  color: var(--label-text);
  font-size: 0.95rem;
  font-weight: 800;
}

.document-type-card__hint {
  margin: 0;
  color: var(--muted-text, #6f746d);
  font-size: 0.88rem;
  line-height: 1.45;
}

.document-type-field {
  display: grid;
  gap: 6px;
  color: var(--label-text);
  font-size: 0.78rem;
  font-weight: 800;
}

.document-type-error {
  margin: 0;
  color: #ffb4a8;
  font-size: 0.88rem;
  font-weight: 700;
}

.document-type-select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--surface-inset);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.document-type-select:focus-visible {
  outline: 3px solid rgba(244, 81, 30, 0.24);
  outline-offset: 2px;
  border-color: var(--accent);
}

.sdk-stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 16px;
  background: var(--card);
  border: 0;
  overflow: hidden;
}

/*
  Session creation no longer blocks the widget. While the request is in flight
  the SDK is already mounted and interactive underneath this badge, which is
  purely informational and never intercepts pointer events.
*/
.sdk-stage.is-pending::after {
  content: "Preparing session";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 106, 47, 0.3);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: stage-pending-pulse 1.4s ease-in-out infinite;
}

@keyframes stage-pending-pulse {
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sdk-stage.is-pending::after {
    animation: none;
  }
}

@media (max-width: 720px) {
  .session-controls {
    padding: 12px;
    gap: 10px;
  }

  .session-controls__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
  }

  .session-id-field {
    grid-column: 1 / -1;
    flex: none;
  }

  .session-id-field input {
    font-size: 16px;
  }

  .session-controls .session-button {
    width: 100%;
    padding: 0 8px;
    font-size: 0.8rem;
  }
}

.stage-status {
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  border-radius: 12px;
  text-align: center;
  color: var(--accent-dark);
  background: var(--card);
  font-size: 1rem;
  font-weight: 700;
}

.stage-status.is-error {
  color: #ffb4a8;
  background: rgba(255, 106, 47, 0.12);
}

.action-card__footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
}

.action-button {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-foreground, #ffffff);
  padding: 0.95rem 1.45rem;
  min-width: 220px;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent) 25%, transparent);
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background-color 120ms ease;
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--accent-hover);
}

.action-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  outline-offset: 4px;
}

.action-button.is-active {
  background: var(--accent-dark);
}

.divider {
  height: 1px;
  margin: 0 4px 32px;
  background: var(--strong-border, #e8e8e8);
}

.details-card {
  background: var(--card);
  border: 1px solid var(--strong-border, #e8e8e8);
  border-radius: 12px;
  padding: 26px;
  box-shadow: var(--shadow-soft);
}

.details-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.details-header h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  color: var(--ink);
}

.details-header p {
  margin: 0;
  color: var(--muted-text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.detail-form {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.form-row--wide {
  grid-column: 1 / -1;
}

.form-row {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--surface-inset);
}

.form-row dt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted-text);
}

.form-row dd {
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.5;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Document check result per field (v2 documentData checkStatus/confidence). */
.form-row dd[data-badge] {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.form-row dd[data-badge]::after {
  content: attr(data-badge);
  color: var(--muted-text);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.form-row dd[data-check="pass"]::after {
  color: var(--result-success);
}

.form-row dd[data-check="fail"]::after {
  color: var(--result-error);
}

.form-row:has(> dd[data-check="fail"]) {
  border-color: var(--result-error);
  background: var(--result-error-soft);
}

.form-row dd[data-empty="true"] {
  color: var(--muted-text);
  font-size: 0.88rem;
  font-weight: 400;
}

.field-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  color: var(--accent);
  background: rgba(244, 81, 30, 0.07);
  border-radius: 8px;
}

.field-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.results-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--strong-border, #e8e8e8);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.results-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--label-text);
}

.results-display {
  font-size: 0.92rem;
}

.results-display pre {
  margin: 0;
  color: var(--code-text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.results-summary {
  display: grid;
  gap: 16px;
}

/* Session header: id + status, failure reason, then a horizontal stat row. */
.results-session {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--strong-border, #e8e8e8);
  border-left: 4px solid var(--status-color, var(--muted-text));
  border-radius: 12px;
  background: var(--surface-inset);
}

.results-session__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.results-session__id {
  min-width: 0;
}

.results-session__id code {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--ink);
  word-break: break-all;
}

.results-session__failure {
  margin: -6px 0 0;
  color: var(--result-error);
  font-weight: 700;
}

.results-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 12px 20px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--strong-border, #e8e8e8);
}

.results-overview dd {
  margin: 0;
}

.results-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-text, #7a7f78);
}

.results-value {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  word-break: break-word;
}

/* Status colour shared by the session header and the step columns. A step
   with no colour of its own must not inherit the session's. */
.results-session,
.result-step-card {
  --status-color: initial;
}

[data-status="succeeded"],
[data-status="completed"] {
  --status-color: var(--result-success);
}

[data-status="failed"],
[data-status="error"],
[data-status="expired"] {
  --status-color: var(--result-error);
}

[data-status="requires-review"],
[data-status="in-progress"] {
  --status-color: var(--result-warning);
}

/* One full-width row per step: images on the left, details on the right. */
.results-step-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.result-step-card {
  min-width: 0;
  padding: 14px 18px;
  border: 1px solid var(--strong-border, #e8e8e8);
  border-left: 4px solid var(--status-color, var(--field-border));
  border-radius: 12px;
  background: var(--surface-inset);
}

.result-step-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.result-step-header::-webkit-details-marker {
  display: none;
}

.result-step-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.result-step[open] > .result-step-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--strong-border, #e8e8e8);
}

/* Disclosure chevron after the title. */
.result-step-title::after {
  content: "▸";
  color: var(--muted-text);
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}

.result-step[open] .result-step-title::after {
  transform: rotate(90deg);
}

.result-step-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-step-body,
.face-match-result {
  display: grid;
  gap: 16px;
  align-items: start;
}

.result-step-main,
.face-match-result__main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

@media (min-width: 760px) {
  .result-step-body,
  .face-match-result {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
  }

  /* Keep the details column aligned when a step has no images. */
  .result-step-body > .result-step-main:only-child,
  .face-match-result > .face-match-result__main:only-child {
    grid-column: 2;
  }
}

.result-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--label-text);
  font-size: 1rem;
  font-weight: 800;
}

.result-step-order {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--chip-bg);
  border: 1px solid var(--field-border);
  color: var(--muted-text);
  font-size: 0.72rem;
  font-weight: 800;
}

.result-badge {
  --badge-color: var(--muted-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--badge-color) 14%, transparent);
  color: var(--badge-color);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.result-badge--lg {
  min-height: 30px;
  padding: 0 14px;
  font-size: 0.8rem;
}

.result-badge--succeeded,
.result-badge--completed {
  --badge-color: var(--result-success);
}

.result-badge--failed,
.result-badge--error,
.result-badge--expired {
  --badge-color: var(--result-error);
}

.result-badge--requires-review,
.result-badge--in-progress {
  --badge-color: var(--result-warning);
}

/* Key figures: label over value, laid out across the column. */
.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px 14px;
  margin: 0;
}

.result-stats dt {
  margin-bottom: 2px;
  color: var(--muted-text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-stats dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 800;
  word-break: break-word;
}

.result-section {
  display: grid;
  gap: 8px;
}

.result-section-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  color: var(--muted-text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-section-label .result-check {
  letter-spacing: normal;
  text-transform: none;
}

.result-step-failure {
  margin: 0;
  color: var(--result-error);
  font-weight: 700;
}

.result-step-time {
  color: var(--muted-text);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Step images: document sides + portrait, or the liveness selfie. */
.result-media {
  display: flex;
  gap: 8px;
}

.result-media__item {
  flex: 1 1 0;
  min-width: 0;
  max-width: 200px;
  margin: 0;
  display: grid;
  gap: 4px;
}

.result-media__item--portrait {
  flex: 0 0 64px;
}

.result-media__item a {
  display: block;
}

.result-media__item img {
  display: block;
  width: 100%;
  height: 120px;
  border-radius: 8px;
  border: 1px solid var(--strong-border, #e8e8e8);
  background: #070809;
  object-fit: contain;
}

.result-media__item--portrait img {
  object-fit: cover;
}

.result-media__item a:hover img,
.result-media__item a:focus-visible img {
  border-color: var(--accent);
}

.result-media__item figcaption {
  color: var(--muted-text);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.result-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--field-border);
  color: var(--chip-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.result-chip--sm {
  min-height: 20px;
  padding: 0 8px;
  font-size: 0.7rem;
}

/* PASS / FAIL / NOT_PERFORMED check pills. */
.result-check {
  --check-color: var(--muted-text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--check-color) 12%, transparent);
  color: var(--check-color);
  font-size: 0.76rem;
  font-weight: 700;
}

.result-check > span {
  font-weight: 900;
}

.result-check--pass {
  --check-color: var(--result-success);
}

.result-check--fail {
  --check-color: var(--result-error);
}

.result-findings {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.86rem;
  font-weight: 600;
}

.result-finding {
  --finding-color: var(--result-error);
  position: relative;
  display: grid;
  gap: 4px;
  padding: 7px 10px 7px 28px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--finding-color) 10%, transparent);
  color: var(--finding-color);
  line-height: 1.35;
}

.result-finding::before {
  content: "✕";
  position: absolute;
  top: 7px;
  left: 10px;
  font-weight: 900;
}

.result-finding--warning {
  --finding-color: var(--result-warning);
}

.result-finding--warning::before {
  content: "!";
}

.result-finding--info {
  --finding-color: var(--muted-text);
}

.result-finding--info::before {
  content: "i";
}

.result-finding__codes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.result-finding__codes code,
.result-table__code {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.8;
}

/* Face match row: compared faces, verdict, similarity gauge. */
.face-match-result {
  --fm-color: var(--muted-text);
}

.face-match-result[data-verdict="match"] {
  --fm-color: var(--result-success);
}

.face-match-result[data-verdict="no-match"] {
  --fm-color: var(--result-error);
}

.face-match-result[data-verdict="review"] {
  --fm-color: var(--result-warning);
}

.face-match-result__extra {
  display: grid;
  gap: 8px;
}

.face-match-result__extra:empty {
  display: none;
}

.face-match-result__verdict {
  display: flex;
  align-items: center;
  gap: 12px;
}

.face-match-result__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fm-color) 14%, transparent);
  color: var(--fm-color);
  font-size: 1.05rem;
  font-weight: 900;
}

.face-match-result__title {
  margin: 0;
  color: var(--fm-color);
  font-size: 1.05rem;
  font-weight: 800;
}

.face-match-result__subtitle {
  margin: 2px 0 0;
  color: var(--muted-text);
  font-size: 0.84rem;
}

.face-match-gauge {
  display: grid;
  gap: 6px;
  max-width: 560px;
}

.face-match-gauge__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--strong-border, #e8e8e8);
}

.face-match-gauge__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--fm-color);
}

.face-match-gauge__threshold {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--ink);
}

.face-match-gauge__legend {
  display: flex;
  justify-content: space-between;
  color: var(--muted-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.face-match-result__faces {
  display: flex;
  align-items: center;
  gap: 8px;
}

.face-match-result__faces figure {
  flex: 1 1 0;
  min-width: 0;
  max-width: 120px;
  display: grid;
  gap: 4px;
  margin: 0;
  text-align: center;
}

.face-match-result__faces img {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  border: 2px solid var(--fm-color);
  background: #070809;
  object-fit: cover;
}

.face-match-result__faces figcaption {
  color: var(--muted-text);
  font-size: 0.72rem;
  font-weight: 700;
}

.face-match-result__vs {
  color: var(--muted-text);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-metric-empty {
  margin: 0;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.results-note {
  margin: -4px 0 0;
  color: var(--muted-text);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Collapsible failed checks / attempts tables. */
.results-details,
.results-json {
  border: 1px solid var(--strong-border, #e8e8e8);
  border-radius: 12px;
  background: var(--surface-inset);
  overflow: hidden;
}

.results-details summary,
.results-json summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  list-style: none;
}

.results-json summary {
  justify-content: space-between;
}

.results-details summary::before,
.results-json__title::before {
  content: "▸";
  display: inline-block;
  color: var(--muted-text);
  transition: transform 0.15s ease;
}

.results-json__title::before {
  margin-right: 8px;
}

.results-details[open] summary::before,
.results-json[open] .results-json__title::before {
  transform: rotate(90deg);
}

.results-details summary::-webkit-details-marker,
.results-json summary::-webkit-details-marker {
  display: none;
}

.results-details__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--field-border);
  color: var(--muted-text);
  font-size: 0.72rem;
}

.result-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--strong-border, #e8e8e8);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.result-table th,
.result-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--strong-border, #e8e8e8);
  text-align: left;
  vertical-align: top;
}

.result-table tr:last-child > * {
  border-bottom: none;
}

.result-table thead th {
  color: var(--muted-text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.result-table tbody th {
  color: var(--ink);
  font-weight: 700;
}

.result-table td {
  color: var(--label-text);
}

.result-table tbody th > * + * {
  margin-top: 4px;
}

.result-table__name,
.result-table__code {
  display: block;
}

.result-table .result-chip {
  margin-right: 4px;
}

.result-value-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 12px 2px 0;
}

.result-value-pair span {
  color: var(--muted-text);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.result-value-pair code {
  color: var(--ink);
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-weight: 700;
}

@media (max-width: 640px) {
  .result-table thead {
    display: none;
  }

  .result-table tr {
    display: grid;
    gap: 4px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--strong-border, #e8e8e8);
  }

  .result-table tr:last-child {
    border-bottom: none;
  }

  .result-table th,
  .result-table td {
    padding: 0;
    border-bottom: none;
  }
}

.results-json {
  background: var(--code-bg);
}

.results-json__actions {
  display: flex;
  gap: 6px;
}

.results-json__button {
  appearance: none;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  padding: 4px 10px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.results-json__button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.results-json pre {
  max-height: 420px;
  overflow: auto;
  padding: 0 14px 14px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.85rem;
}

.results-placeholder {
  color: var(--muted-text, #888);
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--strong-border, #e8e8e8);
  border-radius: 12px;
  background: var(--surface-inset);
  font-size: 0.95rem;
}

.results-placeholder--error {
  color: var(--result-error);
}

.input-prefix {
  flex: 0 0 auto;
  font-size: 1.35rem;
  color: var(--muted-text, #9da29b);
}

yesid-document-capture,
liveness-check,
yesid-liveness-check {
  display: none;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: transparent;
}

/*
  The stages are revealed immediately now, but the browser does not know these
  elements until the SDK bundles evaluate. Fill that gap with a neutral
  skeleton rather than a blank card; the session request is already in flight
  behind it.
*/
yesid-document-capture:not(:defined),
liveness-check:not(:defined),
yesid-liveness-check:not(:defined) {
  min-height: 100%;
  border-radius: 12px;
  background: linear-gradient(
      100deg,
      rgba(255, 255, 255, 0) 30%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0) 70%
    )
    var(--card);
  background-size: 220% 100%;
  animation: stage-skeleton 1.6s linear infinite;
}

@keyframes stage-skeleton {
  from {
    background-position: 160% 0;
  }
  to {
    background-position: -60% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  yesid-document-capture:not(:defined),
  liveness-check:not(:defined),
  yesid-liveness-check:not(:defined) {
    animation: none;
  }
}

#document-stage {
  min-height: 500px;
}

.sdk-stage.is-ready {
  padding: 12px;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: stretch;
}

#selfie-stage.is-ready {
  min-height: 500px;
}

.sdk-stage.is-ready yesid-document-capture,
.sdk-stage.is-ready liveness-check,
.sdk-stage.is-ready yesid-liveness-check {
  display: block;
}

.sdk-stage.is-ready yesid-document-capture {
  min-height: 100%;
}

.sdk-stage.is-ready liveness-check,
.sdk-stage.is-ready yesid-liveness-check {
  align-self: flex-start;
  height: auto;
  min-height: 0;
}

.sdk-stage.is-ready .stage-status {
  display: none;
}

/* --yesid-* is read by the current SDK builds served from /vendor; the
   --doc-scanner-* names keep the older npm build behind /react styled. */
yesid-document-capture {
  --yesid-accent-color: var(--accent);
  --yesid-accent-hover: var(--accent-hover);
  --yesid-accent-foreground: var(--accent-foreground, #ffffff);
  --yesid-icon-color: var(--accent);
  --yesid-surface: var(--card);
  --yesid-text-color: var(--ink);
  --yesid-muted-text-color: var(--muted-text);
  --yesid-border: var(--strong-border);
  --yesid-border-strong: var(--field-border);
  --yesid-shadow-sm: none;
  --doc-scanner-accent: var(--accent);
  --doc-scanner-accent-hover: var(--accent-hover);
  --doc-scanner-accent-text: var(--accent-foreground, #ffffff);
  --doc-scanner-icon-color: var(--accent);
  --doc-scanner-border-radius: 12px;
  --doc-scanner-background: var(--card);
  --doc-scanner-text: var(--ink);
  --doc-scanner-muted: var(--muted-text);
  --doc-scanner-border: var(--strong-border);
  --doc-scanner-border-strong: var(--field-border);
  --doc-scanner-shadow-sm: none;
}

liveness-check,
yesid-liveness-check {
  --yesid-max-width: 100%;
  --yesid-font-family:
    "Trebuchet MS", "Gill Sans", "Avenir Next", sans-serif;
  --yesid-background: var(--card);
  --yesid-text-color: var(--ink);
  --yesid-video-bg: #050607;
  --yesid-card-bg: var(--sdk-card-bg);
  --yesid-card-border: var(--strong-border);
  --yesid-surface: var(--card);
  --yesid-start-button-bg: var(--accent);
  --yesid-start-button-color: var(--accent-foreground, #ffffff);
  --yesid-accent-foreground: var(--accent-foreground, #ffffff);
  --yesid-video-radius: 12px;
  --yesid-button-radius: 8px;
  --yesid-button-padding: 0.9rem 1.4rem;
  --yesid-button-font-size: 0.96rem;
  --yesid-button-font-weight: 800;
  --yesid-accent-color: var(--accent);
}

@media (max-width: 900px) {
  .capture-grid {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 760px) {
  .app-shell {
    padding: 24px 16px 48px;
  }

  .capture-grid {
    gap: 14px;
    margin-bottom: 20px;
  }

  /* Keep the SDK card hugging the action-card border on phones. */
  .action-card {
    gap: 12px;
    padding: 8px;
  }

  /*
    Let the card hug the SDK instead of reserving a fixed stage.

    The old floor here (480px stage / 500px #document-stage / 464px on the
    components) was taller than the source picker actually needs, so the card
    rendered with a large dead area under the Upload option. The scanner grows
    on its own when the camera opens -- `.stage` inside its shadow DOM carries
    `min-height: var(--scanner-stage-min-height)` -- so nothing here needs to
    reserve that room up front.
  */
  .sdk-stage,
  #document-stage {
    min-height: 360px;
    padding: 0;
  }

  /*
    Centre whatever slack is left rather than pinning the widget to the top.
    Base `.sdk-stage.is-ready` uses flex-start/stretch, which is what pushed the
    picker against the top edge.
  */
  .sdk-stage.is-ready {
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  .sdk-stage.is-ready yesid-document-capture,
  .sdk-stage.is-ready liveness-check,
  .sdk-stage.is-ready yesid-liveness-check {
    min-height: 0;
    align-self: center;
  }

  #selfie-stage.is-ready {
    min-height: 360px;
  }

  /*
    Trim the scanner's own inner padding and let its picker use the full card
    width. Two variable names on purpose: the local dev build served through
    /vendor reads `--doc-scanner-source-picker-*`, while the npm build behind
    the /react bundle still derives that padding from `--doc-scanner-spacing-xl`.
    Setting the name the other build ignores costs nothing.
  */
  yesid-document-capture {
    --yesid-source-picker-padding: 12px;
    --yesid-source-picker-max-width: 100%;
    --doc-scanner-spacing-xl: 12px;
    --doc-scanner-source-picker-padding: 12px;
    --doc-scanner-source-picker-max-width: 100%;
  }

  /* Only the error panel still needs a floor -- it has no content of its own. */
  .stage-status {
    min-height: 240px;
  }

  .detail-form {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .details-card {
    padding: 14px;
  }
}

/* Keep long session IDs within the mobile viewport. */
.session-control-status {
  min-width: 0;
  overflow-wrap: anywhere;
}

.session-config-dialog {
  width: min(640px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--field-border);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  overflow-y: auto;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
  .session-config-dialog {
    width: min(740px, calc(100% - 48px));
    padding: 28px 32px;
  }
}

@media (min-width: 960px) {
  .session-config-dialog {
    width: min(840px, calc(100% - 64px));
    padding: 32px 36px;
    border-radius: 16px;
  }
}

.session-config-dialog::backdrop {
  background: rgb(0 0 0 / 60%);
  backdrop-filter: blur(2px);
}

.session-config-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.session-config-dialog-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.session-config-dialog-close {
  appearance: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted-text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.session-config-dialog-close:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.session-config-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.4;
}

.session-config-summary__label {
  color: var(--muted-text, #666963);
}

.session-config-summary__value {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.session-config-hint {
  display: block;
  margin: 4px 0 16px;
  color: var(--muted-text, #666963);
  font-size: 0.85rem;
  font-weight: normal;
  line-height: 1.5;
}

.session-config-dialog fieldset {
  margin: 16px 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.session-config-dialog legend {
  padding: 0;
  font-weight: 800;
}

.session-config-option {
  display: flex;
  align-items: start;
  gap: 10px;
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
}

.session-config-option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.session-config-option .session-config-hint {
  margin-bottom: 0;
}

.session-config-ocr-grid,
.session-config-locale-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}

@media (min-width: 600px) {
  .session-config-ocr-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .session-config-locale-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.session-config-ocr-grid .session-config-option,
.session-config-locale-grid .session-config-option {
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--card);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.session-config-ocr-grid .session-config-option:hover,
.session-config-locale-grid .session-config-option:hover {
  border-color: var(--accent);
}

.session-config-ocr-grid .session-config-option:has(input:checked),
.session-config-locale-grid .session-config-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.session-config-types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 2px;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .session-config-types {
    column-gap: 24px;
  }
}

.session-config-country-group {
  margin-top: 20px;
}

.session-config-country-select-wrapper {
  margin-top: 6px;
}

.session-config-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 18px;
  padding-right: 32px;
}

.session-config-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.session-config-custom-picker {
  margin-top: 10px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: 10px;
  background: rgba(125, 125, 125, 0.04);
}

.session-country-search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.session-country-search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--muted-text);
  pointer-events: none;
}

.session-country-search-input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.85rem;
  font-family: inherit;
}

.session-country-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.session-country-selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  min-height: 24px;
}

.session-country-empty-hint {
  font-size: 0.8rem;
  color: var(--muted-text);
  font-style: italic;
  padding: 2px 0;
}

.session-country-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--accent);
}

.session-country-tag button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.session-country-list {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--card);
}

@media (min-width: 640px) {
  .session-country-list {
    max-height: 200px;
  }
}

.session-country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  border-bottom: 1px solid var(--field-border);
  user-select: none;
}

.session-country-item:last-child {
  border-bottom: none;
}

.session-country-item:hover {
  background: var(--accent-soft);
}

.session-country-item.is-selected {
  background: var(--accent-soft);
  font-weight: 600;
}

.session-country-check {
  width: 14px;
  font-weight: bold;
  color: var(--accent);
  text-align: center;
}

.session-country-name {
  flex: 1;
}

.session-country-code {
  color: var(--muted-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.session-config-credentials-group {
  margin-top: 20px;
}

.session-config-credentials-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.session-config-text-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-config-text-field > span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.session-config-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.session-config-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.session-config-input::placeholder {
  color: var(--muted-text);
  opacity: 0.7;
}

.session-config-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.session-config-input-wrapper .session-config-input {
  padding-right: 36px;
}

.session-config-pw-toggle {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--muted-text);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.session-config-pw-toggle:hover {
  color: var(--ink);
}

.session-config-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 20px;
}

.session-config-error {
  color: var(--accent-dark);
}

@media (max-width: 400px) {
  .session-config-dialog { padding: 16px; }
  .session-config-types { grid-template-columns: 1fr; }
}

/* Light mode keeps large surfaces neutral and uses color for actions and status. */
[data-theme="light"] .session-button--secondary {
  border-color: var(--field-border);
  background: var(--card);
  color: var(--ink);
}

[data-theme="light"] .session-button--secondary:hover {
  background: var(--accent-soft);
}

[data-theme="light"] .document-type-card,
[data-theme="light"] .sdk-stage.is-pending::after {
  background: var(--card);
  border-color: var(--field-border);
  color: var(--muted-text);
}

[data-theme="light"] .document-type-card.needs-selection {
  border-color: var(--accent);
}

[data-theme="light"] .session-control-status.is-success {
  color: var(--muted-text);
}

[data-theme="light"] .action-button {
  box-shadow: none;
}

[data-theme="light"] .document-type-error {
  color: #b42318;
}

[data-theme="light"] yesid-document-capture {
  --yesid-icon-color: var(--muted-text);
  --doc-scanner-icon-color: var(--muted-text);
}

/* Hover magnifier over result images (js/magnifier.js). */
.image-magnifier {
  position: fixed;
  z-index: 1000;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--strong-border, #e8e8e8), 0 10px 24px rgba(0, 0, 0, 0.25);
  background-color: #070809;
  background-repeat: no-repeat;
  pointer-events: none;
}

.image-magnifier[hidden] {
  display: none;
}

.image-magnifier-target {
  cursor: none;
}
