.wallet-cabinet {
  --cabinet-ink: #111b32;
  --cabinet-muted: #42516a;
  --cabinet-navy: #263f61;
  --cabinet-navy-dark: #1b3251;
  --cabinet-line: #d6e1ef;
  --cabinet-focus: #1763a4;
  --cabinet-inline: clamp(12px, 3vw, 40px);
  --cabinet-width: min(1200px, 100% - var(--cabinet-inline) * 2);
  color: var(--cabinet-ink);
  background: radial-gradient(ellipse at 42% 0%, #e1eefb, transparent 62%), linear-gradient(155deg, #f8faff, #edf4fc) #edf4fc;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
}

.cabinet-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.cabinet-icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.cabinet-scroll { min-height: 100vh; display: flex; flex: 1 0 auto; flex-direction: column; }
.wallet-cabinet .exchange-header { min-height: 72px; padding: 0; border-color: var(--cabinet-line); background: #f7fbffe8; }
.cabinet-header-inner { width: var(--cabinet-width); margin-inline: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wallet-cabinet .exchange-brand { min-height: 44px; border-radius: 7px; }
.wallet-cabinet .exchange-brand img { width: auto; height: 48px; aspect-ratio: 936.02 / 336.34; }
.cabinet-header-actions { display: flex; align-items: center; gap: 16px; }
.cabinet-header-actions a { display: inline-flex; min-height: 44px; align-items: center; border-radius: 8px; color: var(--cabinet-navy); font-size: .86rem; font-weight: 650; }
.cabinet-header-actions a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cabinet-header-actions .cabinet-header-help { display: none; }
.cabinet-header-help:focus-visible, .cabinet-nav a:focus-visible, .cabinet-support a:focus-visible { outline: 3px solid var(--cabinet-focus); outline-offset: 2px; }

.wallet-cabinet .exchange-main { width: var(--cabinet-width); padding-block: 16px 30px; }
.wallet-cabinet .exchange-layout { grid-template-columns: minmax(0, 1fr) minmax(360px, 430px) minmax(0, 1fr); gap: clamp(16px, 3vw, 36px); }
.cabinet-center { position: relative; min-width: 0; }
.wallet-cabinet .exchange-form { width: 100%; margin: 0; }

.cabinet-nav, .cabinet-support {
  position: sticky;
  top: 16px;
  display: grid;
  min-width: 0;
  padding: 10px;
  border: 1px solid #fff;
  border-radius: 20px;
  background: linear-gradient(150deg, #faffffef, #eef5fbe8);
  box-shadow: 0 10px 24px #28466b12;
}
.cabinet-nav { width: min(100%, 220px); gap: 4px; }
.cabinet-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--cabinet-navy);
  font-size: .91rem;
  font-weight: 625;
}
.cabinet-nav a:hover { background: #e6f0fb; }
.cabinet-nav a[aria-current="page"] { border-color: #c8daef; background: #dceafb; color: var(--cabinet-navy-dark); font-weight: 740; }
.cabinet-support { width: min(100%, 220px); justify-self: end; padding: 16px; }
.cabinet-support h2 { margin: 0 0 5px; font-size: 1rem; line-height: 1.35; }
.cabinet-support a { display: flex; align-items: center; min-height: 44px; border-radius: 6px; color: var(--cabinet-navy); font-size: .86rem; font-weight: 620; }
.cabinet-support a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wallet-cabinet .exchange-consent #exchange-continue:not(:disabled), .wallet-cabinet .sdk-action-primary { background: var(--cabinet-navy); }
.wallet-cabinet .exchange-consent #exchange-continue:hover:not(:disabled), .wallet-cabinet .sdk-action-primary:hover { background: var(--cabinet-navy-dark); }
.wallet-cabinet :is(.sdk-action-links a, .sdk-error button) { min-height: 44px; }
.wallet-cabinet .sdk-card { width: 100%; margin: 0; }
.wallet-cabinet .sdk-card[data-state="loading"] .sdk-mount { min-width: 0; }
.wallet-cabinet .sdk-card[data-state="ready"] { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }

/* The mounted form owns its visual heading. Keep the page title for assistive technology. */
.exchange-page-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.cabinet-center:has(.sdk-card[data-state="ready"]:not([hidden])) .exchange-note { display: none; }

@media (max-width: 900px) {
  .wallet-cabinet {
    --cabinet-nav-space: calc(66px + env(safe-area-inset-bottom));
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  /* Reserve the bar's space outside the scrollport, including when a frame control receives focus. */
  .cabinet-scroll {
    flex: none;
    height: calc(100% - var(--cabinet-nav-space));
    min-height: 0;
    padding-bottom: 16px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-block-end: 16px;
  }
  .wallet-cabinet .exchange-header { min-height: 64px; flex-shrink: 0; }
  .wallet-cabinet .exchange-brand img { height: 40px; }
  .cabinet-header-actions .cabinet-header-help { display: inline-flex; }
  .cabinet-header-actions { gap: 12px; }
  .wallet-cabinet .exchange-main { width: 100%; padding-block: 12px 24px; }
  .wallet-cabinet .exchange-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cabinet-center { width: min(100%, 430px); margin-inline: auto; }
  .wallet-cabinet :is(.exchange-consent, .sdk-card:not([data-state="ready"]), .exchange-note) { width: auto; margin-inline: var(--cabinet-inline); }
  .cabinet-support, .cabinet-nav .cabinet-nav-help { display: none; }
  .cabinet-nav {
    position: fixed;
    z-index: 20;
    inset: auto 0 0;
    width: 100%;
    height: var(--cabinet-nav-space);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px max(5px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--cabinet-line);
    border-radius: 0;
    background: #f7fbff;
    box-shadow: 0 -5px 22px #28466b12;
  }
  .cabinet-nav a { flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding: 2px; border-radius: 10px; font-size: clamp(.68rem, 3vw, .81rem); line-height: 1.2; }
  .cabinet-nav a:focus-visible { outline-offset: -2px; }
  .cabinet-nav .cabinet-icon { width: 20px; height: 20px; }
}
