:root {
  color-scheme: light;
  --fw-bg: #090b11;
  --fw-bg-soft: #0d1018;
  --fw-panel-line: #2a3448;
  --fw-brand: #2d5bff;
  --fw-brand-hover: #2149d6;
  --fw-accent: #00d2b8;
  --ft-accent-ink: #007f70;
  --ft-canvas: #f4f6fa;
  --ft-surface: #ffffff;
  --ft-surface-soft: #f8f9fc;
  --ft-text: #182033;
  --ft-muted: #5d6879;
  --ft-line: #d9deea;
  --ft-line-strong: #bac3d3;
  --ft-warning-bg: #fff4d6;
  --ft-warning-text: #704000;
  --ft-danger: #b42318;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: var(--ft-text);
  background: var(--ft-canvas);
}

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

body {
  min-height: 100vh;
  background: var(--ft-canvas);
}

a {
  color: var(--fw-brand);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 16px;
}

.app-header,
header.app-header {
  position: relative;
  padding: 0;
  background: var(--fw-bg);
  color: white;
  border-bottom: 1px solid rgba(42, 52, 72, 0.72);
}

.app-header::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: var(--fw-accent);
}

.app-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(100%, 1180px);
  min-height: 78px;
  margin: 0 auto;
  padding: 14px 24px;
}

.brand-lockup {
  display: grid;
  gap: 1px;
  flex: 0 0 auto;
  color: white;
  text-decoration: none;
}

.brand-company {
  color: var(--fw-accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.brand-product {
  font-family: "Space Grotesk", Inter, Segoe UI, Arial, sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.05;
}

.header-context {
  min-width: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
}

.language-switch-button {
  min-width: 56px;
  padding: 5px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.language-switch-button[aria-pressed="true"] {
  background: white;
  color: #0f766e;
}

.header-links a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.header-links a:hover,
.header-links a:focus-visible {
  color: white;
}

.visitor-header .app-header-inner {
  max-width: 720px;
}

.visitor-header .code-chip {
  margin-left: auto;
}

main {
  width: min(100%, 1180px);
}

section {
  border-color: var(--ft-line);
  border-radius: 8px;
  background: var(--ft-surface);
  box-shadow: 0 1px 2px rgba(24, 32, 51, 0.04);
}

button,
.button-like,
.button-link {
  min-height: 40px;
  border-radius: 6px;
  background: var(--fw-brand);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
.button-like:hover,
.button-link:hover {
  background: var(--fw-brand-hover);
}

button.secondary,
.secondary,
.button-like.secondary {
  border: 1px solid var(--ft-line-strong);
  background: white;
  color: var(--ft-text);
}

button.secondary:hover,
.secondary:hover,
.button-like.secondary:hover {
  border-color: var(--fw-brand);
  background: #f2f5ff;
  color: var(--fw-brand);
}

button.danger,
.button-like.danger {
  border: 1px solid var(--ft-danger);
  background: white;
  color: var(--ft-danger);
}

button.danger:hover,
.button-like.danger:hover {
  background: #fff1f0;
  color: #8f1c13;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(0, 210, 184, 0.32);
  outline-offset: 2px;
}

input,
textarea,
select {
  width: 100%;
  border-color: var(--ft-line-strong);
  background: white;
  color: var(--ft-text);
}

.hint,
.helper,
.muted,
.metric-label,
.history,
.footer-note {
  color: var(--ft-muted);
}

.badge {
  border-radius: 999px;
  background: #dff8f3;
  color: var(--ft-accent-ink);
}

.badge.warn {
  background: var(--ft-warning-bg);
  color: var(--ft-warning-text);
}

.status-panel {
  border-left: 4px solid var(--fw-accent);
  background: var(--ft-surface);
}

#sessionPanel:not(.signed-in) {
  justify-self: center;
  width: min(100%, 640px);
  padding: 28px;
}

#sessionPanel:not(.signed-in) #sessionTitle,
.new-account-panel h3 {
  margin: 0;
}

#sessionPanel:not(.signed-in) .auth-form {
  gap: 14px;
}

.auth-step {
  width: min(100%, 430px);
}

.login-guidance {
  display: grid;
  gap: 4px;
  max-width: 540px;
}

.new-account-panel {
  display: grid;
  gap: 8px;
  max-width: 540px;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--ft-line);
}

.new-account-panel .button-like {
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.marketplace-inline-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--ft-line);
}

.marketplace-inline-copy {
  display: grid;
  gap: 3px;
}

.status-panel.signed-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
  border-left-width: 0;
  background: transparent;
  box-shadow: none;
}

.status-panel.signed-in .status-line {
  min-width: 0;
}

.status-panel.signed-in #sessionSummary {
  color: var(--ft-text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.selection-context[hidden] {
  display: none;
}

.selection-context {
  position: sticky;
  top: 0;
  z-index: 12;
  box-shadow: 0 5px 14px rgb(16 24 40 / 7%);
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--ft-line);
  background: transparent;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-button {
  position: relative;
  flex: 0 0 auto;
  min-height: 46px;
  border: 0;
  border-radius: 0;
  padding: 10px 14px;
  background: transparent;
  color: var(--ft-muted);
}

.tab-button:hover {
  background: #eef1f8;
  color: var(--ft-text);
}

.tab-button[aria-selected="true"] {
  background: transparent;
  color: var(--fw-brand);
}

.tab-button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 10px -1px;
  height: 3px;
  background: var(--fw-brand);
}

.tab-label-mobile {
  display: none;
}

.personal-foretwin-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--ft-line);
  border-radius: 8px;
  padding: 14px;
  background: var(--ft-surface-soft);
}

.personal-foretwin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.personal-foretwin-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.personal-foretwin-summary .hint {
  margin: 0;
}

.personal-qr-details {
  border-top: 1px solid var(--ft-line);
  padding-top: 4px;
}

.personal-qr-content,
.identifier-export-content,
.form-settings-content {
  display: grid;
  gap: 12px;
  padding-top: 10px;
}

.personal-qr-content img {
  width: min(220px, 100%);
  height: auto;
  border: 10px solid #fff;
  background: #fff;
  image-rendering: pixelated;
}

.identifier-export-panel {
  display: block;
}

.identifier-export-panel > summary {
  color: var(--fw-brand);
}

.owned-identifier-row {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.owned-identifier-checkbox,
.identifier-public-code {
  display: none;
}

.identifier-selection-active .owned-identifier-row {
  grid-template-columns: auto minmax(180px, 1fr) minmax(180px, auto) auto;
}

.identifier-selection-active .owned-identifier-checkbox {
  display: grid;
}

.identifier-selection-active .identifier-public-code {
  display: block;
}

.tab-panel {
  display: grid;
  gap: 16px;
}

.tab-panel[hidden] {
  display: none;
}

.qr-card,
.request-card,
.metric-tile,
.summary-item,
.mode-panel {
  border-color: var(--ft-line);
  border-radius: 8px;
  background: var(--ft-surface-soft);
}

.attachment-preview,
.attachment-thumb {
  display: block;
  width: min(100%, 360px);
  max-height: 280px;
  margin-top: 10px;
  object-fit: contain;
  border: 1px solid var(--ft-line);
  border-radius: 6px;
  background: #fff;
}

.attachment-preview:not(.visible) {
  display: none;
}

.owned-identifier-list {
  border-color: var(--ft-line);
}

.owned-identifier-row {
  border-bottom-color: var(--ft-line);
}

.qr-url,
.request-summary {
  background: #eef1f8;
}

.inbox-controls {
  display: grid;
  gap: 6px;
  width: min(100%, 420px);
  margin-block: 14px;
}

.inbox-controls label {
  font-size: 13px;
  font-weight: 700;
}

.request-target {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.request-target .helper {
  font-size: 11px;
  text-transform: uppercase;
}

.inbox-pagination {
  justify-content: space-between;
  margin-top: 16px;
}

.page-footer {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 10px 24px 26px;
  color: var(--ft-muted);
  font-size: 12px;
  text-align: center;
}

.page-footer a {
  font-weight: 700;
}

@media (max-width: 700px) {
  .app-header-inner {
    flex-wrap: wrap;
    gap: 8px 18px;
    min-height: 70px;
    padding: 13px 16px;
  }

  .header-context {
    order: 3;
    flex-basis: 100%;
  }

  .header-actions {
    gap: 10px;
  }

  .header-links {
    gap: 12px;
  }

  .header-links a {
    font-size: 13px;
  }

  .language-switch-button {
    min-width: 50px;
    padding-inline: 7px;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin-inline: -14px;
    padding-inline: 8px;
    overflow: visible;
  }

  .tab-button {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    padding: 8px 3px;
    font-size: 12px;
    line-height: 1.2;
    white-space: normal;
  }

  .tab-label-desktop {
    display: none;
  }

  .tab-label-mobile {
    display: inline;
  }

  .personal-foretwin-heading,
  .personal-foretwin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .personal-foretwin-actions .button-like,
  .personal-foretwin-actions button {
    justify-content: center;
    width: 100%;
  }

  .selection-context {
    position: static;
    box-shadow: none;
  }

  #sessionPanel:not(.signed-in) {
    padding: 18px;
  }

  .marketplace-inline-action {
    align-items: stretch;
    flex-direction: column;
  }

  .marketplace-inline-action button {
    align-self: start;
  }

  .owned-identifier-row,
  .identifier-selection-active .owned-identifier-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .owned-identifier-row > div:first-of-type {
    grid-column: 1;
  }

  .identifier-selection-active .owned-identifier-checkbox,
  .identifier-selection-active .identifier-public-code,
  .owned-identifier-actions {
    grid-column: 1;
  }

  .owned-identifier-actions {
    justify-content: flex-start;
  }
}

.application-reply-choice {
  padding: 16px;
  margin: 18px 0;
  border: 1px solid var(--ft-line-strong);
  border-left: 4px solid var(--ft-accent-ink);
  border-radius: 8px;
  background: var(--ft-surface-soft);
}
.application-reply-choice h3 { margin-top: 0; }
.application-reply-choice .checkbox-row { display: flex; align-items: flex-start; gap: 10px; }
.application-reply-choice input[type="checkbox"] { width: 20px; height: 20px; margin: 0; flex: 0 0 20px; }
.reply-consent-text { font-size: 14px; line-height: 1.65; }
.private-application-replies .toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.private-application-replies h2 { flex: 1 1 230px; margin: 0; }
.private-reply-card { border-top: 1px solid var(--ft-line); padding: 18px 0; }
.private-reply-card h3 { margin: 0 0 8px; overflow-wrap: anywhere; }
.private-reply-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.application-reply-choice[hidden], .application-reply-choice [hidden],
.private-application-replies[hidden], .private-application-replies [hidden],
#restartUncertainRequest[hidden] { display: none !important; }

@media print {
  .app-header,
  .tabs,
  .page-footer,
  button {
    display: none !important;
  }

  body,
  main {
    background: white;
  }

  section {
    box-shadow: none;
  }
}
