/* Layout shell */

.app-frame {
  /* Additive chrome heights — do NOT assume a prototype banner exists */
  --chrome-proto: 0px;
  --chrome-ticker: 0px;
  --chrome-h: calc(var(--chrome-proto) + var(--chrome-ticker));
  --sidebar-current-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  overflow-x: clip;
}

.app-frame.sidebar-collapsed {
  --sidebar-current-width: var(--sidebar-width-collapsed);
}

.app-frame.has-proto {
  --chrome-proto: var(--proto-banner-height);
}

.app-frame.has-deal-ticker {
  --chrome-ticker: var(--deal-ticker-height);
}

.app-top-chrome {
  flex-shrink: 0;
  z-index: 60;
}

.proto-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  min-height: var(--proto-banner-height);
  padding: 6px var(--space-4);
  background: linear-gradient(90deg, #1a2d42 0%, #24384f 50%, #1a2d42 100%);
  color: #b8c5d4;
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.proto-banner strong {
  color: #e8eef5;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.proto-banner-note {
  color: rgba(184, 197, 212, 0.85);
  font-size: 0.68rem;
}

.proto-banner label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c5d0dc;
}

.proto-banner select {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: var(--text-xs);
  transition: border-color var(--transition);
}

.proto-banner select:hover,
.proto-banner select:focus {
  border-color: rgba(255, 255, 255, 0.28);
  outline: none;
}

.proto-banner input[type="checkbox"] {
  accent-color: #5b9bc9;
}

.app-shell {
  --sidebar-current-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-x: clip;
  position: relative;
}

.app-shell.sidebar-collapsed {
  --sidebar-current-width: var(--sidebar-width-collapsed);
}

.app-body {
  margin-left: var(--sidebar-current-width);
  flex: 1 1 auto;
  width: calc(100% - var(--sidebar-current-width));
  max-width: calc(100% - var(--sidebar-current-width));
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  overflow-x: clip;
  transition: margin-left var(--transition-slow), width var(--transition-slow), max-width var(--transition-slow);
}

.app-sidebar {
  position: fixed;
  left: 0;
  top: var(--chrome-h, 0px);
  bottom: 0;
  width: var(--sidebar-current-width);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 253, 0.98) 100%);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
  backdrop-filter: blur(8px);
  transition: width var(--transition-slow);
  isolation: isolate;
}

.app-shell.support-flyout-open .app-sidebar {
  overflow: visible;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
  max-height: var(--header-height);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.96);
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--transition), padding var(--transition-slow);
  box-sizing: border-box;
}

.brand-block:hover {
  background: rgba(18, 48, 79, 0.04);
}

.brand-block:focus-visible {
  outline: 2px solid var(--color-accent-mid);
  outline-offset: -2px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background:
    linear-gradient(145deg, var(--color-accent) 0%, #1a4a6e 55%, var(--color-accent-bright) 140%);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--color-text);
  line-height: 1.15;
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.nav-list {
  padding: var(--space-3) var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
}

.nav-sep {
  height: 1px;
  margin: 8px 10px;
  background: #e6e9ee;
  border: 0;
  flex: 0 0 auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  position: relative;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.nav-link.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
  border-color: rgba(18, 48, 79, 0.06);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.nav-link .icon {
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-link.active .icon {
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(248, 251, 253, 0.96) 0%, #fff 40%);
  position: relative;
  z-index: 70;
  overflow: visible;
}

/* Divider toggle: fixed on app-frame so shell/body overflow-x:clip cannot cut it */
.sidebar-collapse-btn {
  position: fixed;
  top: calc(var(--chrome-h, 0px) + var(--header-height) / 2);
  left: calc(var(--sidebar-current-width) - 17px);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid var(--color-accent-mid);
  border-radius: 999px;
  background: #fff;
  color: var(--color-accent);
  box-shadow: 0 2px 10px rgba(12, 26, 43, 0.18), 0 0 0 3px rgba(255, 255, 255, 0.95);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    left var(--transition-slow),
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

.sidebar-collapse-btn:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 4px 14px rgba(12, 26, 43, 0.22), 0 0 0 3px rgba(255, 255, 255, 0.95);
}

.sidebar-collapse-btn:focus-visible {
  outline: 2px solid var(--color-accent-mid);
  outline-offset: 2px;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-link > span:not(.icon),
.app-shell.sidebar-collapsed .settings-back > span:not(.icon),
.app-shell.sidebar-collapsed .settings-nav-heading,
.app-shell.sidebar-collapsed .quick-links,
.app-shell.sidebar-collapsed .sidebar-legal,
.app-shell.sidebar-collapsed .sidebar-copy,
.app-shell.sidebar-collapsed .sidebar-support-left > span,
.app-shell.sidebar-collapsed .sidebar-support .icon:last-child {
  overflow: hidden;
  width: 0;
  height: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.app-shell.sidebar-collapsed .brand-block {
  justify-content: center;
  padding-inline: var(--space-2);
}

.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding-inline: 0.75rem;
  gap: 0;
}

.app-shell.sidebar-collapsed .nav-link.active {
  box-shadow: inset 2px 0 0 var(--color-accent);
}

.app-shell.sidebar-collapsed .nav-sep {
  margin-inline: 6px;
}

.app-shell.sidebar-collapsed .settings-back {
  justify-content: center;
  padding-inline: 0.5rem;
  gap: 0;
}

.app-shell.sidebar-collapsed .sidebar-footer {
  padding: var(--space-3) var(--space-2);
  align-items: center;
}

.app-shell.sidebar-collapsed .sidebar-support {
  justify-content: center;
  width: auto;
  min-width: 44px;
  padding-inline: 0.65rem;
}

.app-shell.sidebar-collapsed .sidebar-support-left {
  gap: 0;
}

.sidebar-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.sidebar-legal a {
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.sidebar-legal a:hover {
  text-decoration: underline;
}

.sidebar-copy {
  margin: 0;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.sidebar-support-wrap {
  position: relative;
  z-index: 60;
}

.sidebar-support {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: none;
  border-radius: 10px;
  background: var(--color-accent);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(18, 48, 79, 0.22);
  transition:
    background 200ms ease,
    border-radius 280ms ease,
    box-shadow 280ms ease;
}

.sidebar-support-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.sidebar-support .icon {
  color: #fff;
  flex-shrink: 0;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-support:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.sidebar-support.is-open {
  border-radius: 0 0 10px 10px;
  box-shadow: 0 2px 8px rgba(18, 48, 79, 0.18);
}

.sidebar-support.is-open .icon:last-child {
  transform: rotate(180deg);
}

.support-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 0 4px;
  background: #fff;
  border: 1px solid rgba(18, 48, 79, 0.08);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -10px 28px rgba(12, 26, 43, 0.12);
  transform: translateY(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 260ms ease,
    visibility 0s linear 320ms;
}

.sidebar-support-wrap.is-open .support-panel,
.support-panel.is-visible {
  visibility: visible;
  pointer-events: auto;
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 260ms ease,
    visibility 0s linear 0s;
}

.sidebar-support-wrap.is-open .support-panel {
  transform: translateY(0);
  opacity: 1;
}

.support-panel a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.7rem 0.95rem;
  color: #5a6f86;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 0;
  opacity: 0;
  transform: translateY(10px);
  transition:
    background 160ms ease,
    color 160ms ease,
    opacity 280ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-support-wrap.is-open .support-panel a {
  opacity: 1;
  transform: translateY(0);
}

.sidebar-support-wrap.is-open .support-panel a:nth-child(1) { transition-delay: 40ms; }
.sidebar-support-wrap.is-open .support-panel a:nth-child(2) { transition-delay: 80ms; }
.sidebar-support-wrap.is-open .support-panel a:nth-child(3) { transition-delay: 120ms; }
.sidebar-support-wrap.is-open .support-panel a:nth-child(4) { transition-delay: 160ms; }

.support-panel a .icon {
  color: #7a8fa3;
  flex-shrink: 0;
}

.support-panel a:hover {
  background: #f3f7fa;
  color: var(--color-text);
}

.support-panel a:hover .icon {
  color: var(--color-accent-mid);
}

/* Collapsed sidebar: panel floats beside the icon rail; launcher stays in the footer */
.app-shell.sidebar-collapsed .sidebar-support.is-open {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.35),
    0 2px 8px rgba(18, 48, 79, 0.22);
}

.app-shell.sidebar-collapsed.support-flyout-open .support-panel.is-visible {
  position: fixed;
  top: auto;
  right: auto;
  z-index: 90;
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  padding: 6px 0;
  background: #fff;
  border: 1px solid rgba(18, 48, 79, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(12, 26, 43, 0.16);
}

.app-shell.sidebar-collapsed.support-flyout-open .support-panel.is-visible a {
  opacity: 1;
  transform: none;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .support-panel,
  .support-panel a,
  .sidebar-support .icon {
    transition: none;
  }
}

.legal-page {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.legal-page-header h1 {
  color: var(--color-text);
}

.legal-page-header .subtitle {
  color: var(--color-text-muted);
  max-width: 48ch;
}

.legal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
}

.legal-section + .legal-section {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.legal-section h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  font-weight: 700;
  color: #1a2b48;
}

.legal-section p {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.55;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section a {
  font-weight: 600;
}

.legal-back {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}

.legal-back a {
  font-weight: 600;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.support-tile {
  display: block;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.support-tile:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.support-tile h2 {
  margin: 0 0 6px;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  font-weight: 700;
  color: #1a2b48;
}

.support-tile p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.55;
}

.support-tile a {
  font-weight: 600;
}

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

.app-header-stack {
  position: relative;
  z-index: 100;
  isolation: isolate;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  overflow: visible;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-height);
  padding: 0 var(--space-6);
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 3;
  overflow: visible;
  flex-shrink: 0;
}

.app-shell--deals-browse .app-header-stack .app-header {
  border-bottom: none;
}

.app-shell--deals-browse .app-body {
  overflow: hidden;
  overflow-x: clip;
  min-width: 0;
  max-width: calc(100% - var(--sidebar-current-width));
}

.app-shell--deals-browse .app-header-stack {
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  z-index: 100;
}

.app-shell--deals-browse .app-header {
  min-width: 0;
  max-width: 100%;
  position: relative;
  z-index: 3;
}

.app-shell--deals-browse .app-header-sub {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.app-shell--deals-browse .header-right {
  min-width: 0;
  flex-shrink: 1;
}

.app-header-sub:empty {
  display: none;
}

.app-header-sub .deals-toolbar-bar {
  position: static;
  top: auto;
  z-index: auto;
  margin: 0;
  padding: 8px var(--space-6);
  border-bottom: 1px solid var(--color-border);
  box-shadow: none;
  background: transparent;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  box-sizing: border-box;
}

.app-main.app-main--deals-browse {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  margin-inline: 0;
  padding: var(--space-4) 0 0;
  overflow: hidden;
  overflow-x: clip;
  position: relative;
  z-index: 0;
  isolation: isolate;
  animation: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.header-page-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
  color: var(--color-text);
  white-space: nowrap;
}

.header-refresh {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.header-glossary-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  border: 1.5px solid #2a6f8f;
  background: #fff;
  color: #1a5a75;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.header-glossary-btn:hover {
  background: #eef6fa;
  border-color: #1a5a75;
  color: #12304f;
  box-shadow: 0 0 0 3px rgba(42, 111, 143, 0.12);
}

.header-glossary-btn .icon {
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.menu-toggle {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  color: var(--color-text);
  transition: background var(--transition), border-color var(--transition);
}

.menu-toggle:hover {
  background: var(--color-surface-muted);
}

.app-main {
  padding: var(--space-6) calc(var(--space-6) + var(--scroll-content-gap)) var(--space-10) var(--space-6);
  max-width: min(100%, var(--content-max));
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
  box-sizing: border-box;
  animation: fade-up var(--transition-slow) ease both;
}

.app-main--admin {
  max-width: min(100%, var(--content-max-admin));
  overflow-x: auto;
}

.app-main--account {
  max-width: min(100%, 1100px);
}

.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-3) var(--space-4) var(--space-2);
  padding: 0.35rem 0.25rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  width: fit-content;
  transition: color var(--transition);
}

.settings-back:hover {
  color: var(--color-accent);
}

.settings-nav {
  padding-top: var(--space-2);
}

.settings-nav-heading {
  margin: var(--space-4) 0.85rem var(--space-2);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.settings-nav-heading:first-child {
  margin-top: var(--space-2);
}

.app-sidebar--account .settings-nav-link.active {
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border-color: rgba(42, 82, 120, 0.35);
  box-shadow: none;
  font-weight: 600;
}

.app-sidebar--account .settings-nav-link.active .icon {
  color: var(--color-accent-mid);
  opacity: 1;
}

.payout-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.4rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.payout-chip strong {
  color: var(--color-text);
  font-weight: 700;
  margin-left: 2px;
}

.payout-chip-icon {
  color: #c9a227;
  font-size: 0.95rem;
  line-height: 1;
}

.header-link-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #2a5278;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 650;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(42, 82, 120, 0.35);
}

.header-link-btn:hover {
  color: #12304f;
  background: rgba(42, 82, 120, 0.06);
  text-decoration-color: currentColor;
}

.account-page-header {
  margin-bottom: var(--space-5);
}

.account-page-header h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.account-page-header .subtitle {
  max-width: 48ch;
}

.account-surface {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  max-width: 720px;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: none;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.form-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.form-section-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.account-form .field {
  margin: 0;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.form-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-2);
}

.form-meta-row--end {
  justify-content: flex-end;
}

.form-meta-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.form-meta-value {
  margin: 2px 0 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.bbb-id-lead {
  margin: 0 0 12px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
  max-width: 52rem;
}

.bbb-id-field {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 360px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.bbb-id-input {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.bbb-id-copy {
  appearance: none;
  border: none;
  border-left: 1px solid var(--color-border);
  background: #eef3f8;
  color: #2a5278;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  padding: 0 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.bbb-id-copy:hover {
  background: #e2ebf4;
  color: #12304f;
}

.bbb-id-how {
  margin-top: 12px;
}

.bbb-id-how > summary {
  cursor: pointer;
  color: #2a5278;
  font-size: var(--text-sm);
  font-weight: 650;
  list-style: none;
}

.bbb-id-how > summary::-webkit-details-marker {
  display: none;
}

.bbb-id-how > summary::after {
  content: ' ▾';
  font-size: 0.75em;
}

.bbb-id-how[open] > summary::after {
  content: ' ▴';
}

.bbb-id-list {
  margin: 10px 0 0;
  padding-left: 1.15rem;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.bbb-id-list li + li {
  margin-top: 6px;
}

.bbb-id-example {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #12304f;
  color: #fff;
  max-width: 360px;
}

.bbb-id-example-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.bbb-id-example-card {
  background: #fff;
  color: var(--color-text);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bbb-id-example-label {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.bbb-id-example-card p {
  margin: 0;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  font-size: 0.78rem;
}

.bbb-id-example-card span {
  color: var(--color-text-muted);
}

.bbb-id-example-card strong {
  font-weight: 650;
  word-break: break-word;
}

.input-icon--wa {
  color: var(--color-accent-mid);
}

.wa-logo {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
}

.country-picker {
  position: relative;
}

.country-picker-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: #fff;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.country-picker-trigger:hover,
.country-picker.is-open .country-picker-trigger {
  border-color: var(--color-accent-mid);
  box-shadow: var(--shadow-focus);
}

.country-picker-trigger .icon {
  margin-left: auto;
  color: var(--color-text-muted);
  transition: transform 180ms ease;
}

.country-picker.is-open .country-picker-trigger .icon {
  transform: rotate(180deg);
}

.country-picker-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-flag {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(12, 26, 43, 0.08);
  flex-shrink: 0;
}

.country-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

.country-picker-menu[hidden] {
  display: none;
}

.country-picker-search {
  flex-shrink: 0;
  padding: 2px 2px 8px;
}

.country-picker-search .input {
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  font-size: var(--text-sm);
}

.country-picker-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: left;
}

.country-option[hidden],
.country-option.is-hidden {
  display: none;
}

.country-option:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.country-option.is-selected {
  background: rgba(59, 179, 154, 0.12);
  color: var(--color-text);
  font-weight: 600;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 6px;
}

.field-label-row label {
  margin-bottom: 0;
}

.label-note {
  margin-left: 4px;
  font-size: 0.78rem;
  font-weight: 400;
  font-style: italic;
  color: var(--color-text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.field-label {
  display: inline;
}

.req {
  color: #d64545;
  font-weight: 700;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #2563eb;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover {
  text-decoration: underline;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.input-with-icon .input {
  padding-left: 2.35rem;
}

.input-with-icon--trail .input {
  padding-left: 0.85rem;
  padding-right: 2.6rem;
}

.input-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
}

.input-eye:hover {
  color: var(--color-text);
  background: var(--color-surface-muted);
}

.account-form-actions {
  margin-top: var(--space-2);
}

@media (max-width: 720px) {
  .payout-chip {
    display: none;
  }

  .header-glossary-btn span {
    display: none;
  }

  .header-glossary-btn {
    padding: 0.35rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .account-surface {
    padding: var(--space-4);
  }
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.page-header > div:first-child {
  min-width: 0;
  flex: 1 1 12rem;
}

.page-header h1 {
  margin-bottom: var(--space-2);
}

.page-header .subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  max-width: 42ch;
}

.page-header .actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 0 0 auto;
  max-width: 100%;
}

.page-header .actions .btn {
  white-space: nowrap;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 960px) {
  .app-body {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }

  .app-shell--deals-browse .app-body {
    max-width: 100%;
  }

  .app-sidebar {
    width: min(300px, 88vw);
    transform: translateX(-105%);
    transition: transform var(--transition-slow), width var(--transition-slow);
    box-shadow: var(--shadow-lg);
    background: var(--color-surface);
  }

  .app-shell.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-collapsed .app-sidebar {
    width: min(300px, 88vw);
  }

  .sidebar-collapse-btn {
    display: none !important;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 26, 43, 0.42);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }

  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-main {
    padding-block: var(--space-4) var(--space-8);
    padding-inline-start: var(--space-4);
    padding-inline-end: calc(var(--space-4) + var(--scroll-content-gap));
  }

  .app-main--deals-browse {
    padding: var(--space-4) 0 0;
  }
}

@media (max-width: 640px) {
  :root {
    --proto-banner-height: 36px;
    --deal-ticker-height: 32px;
    --header-height: 52px;
  }

  .proto-banner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 4px 10px;
    min-height: var(--proto-banner-height);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .proto-banner::-webkit-scrollbar {
    display: none;
  }

  .proto-banner-note {
    display: none;
  }

  .proto-banner strong,
  .proto-banner label {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .proto-banner select {
    max-width: 9.5rem;
  }

  .app-header {
    padding: 0 var(--space-3);
    gap: var(--space-2);
    min-height: var(--header-height);
  }

  .header-right {
    flex-wrap: nowrap;
    gap: var(--space-2);
  }

  .header-title {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-glossary-btn span {
    display: none;
  }

  .header-glossary-btn {
    padding: 0.32rem;
    gap: 0;
  }

  .app-main {
    padding-block: var(--space-3) var(--space-8);
    padding-inline-start: var(--space-3);
    padding-inline-end: calc(var(--space-3) + var(--scroll-content-gap));
  }

  .app-main--deals-browse {
    padding: var(--space-3) 0 0;
  }

  h1 {
    font-size: var(--text-xl);
  }

  .hide-sm {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deal-card:hover,
  .deal-card:hover .deal-card-media img {
    transform: none;
  }

  .deal-ticker-track {
    animation: none !important;
  }
}

/* Deal ticker */
.deal-ticker {
  height: var(--deal-ticker-height);
  overflow: hidden;
  background: #0f172a;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
}

.deal-ticker-track {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  white-space: nowrap;
  width: max-content;
  animation: deal-ticker-scroll 85s linear infinite;
  padding-left: 1rem;
}

.deal-ticker:hover .deal-ticker-track,
.deal-ticker:focus-within .deal-ticker-track {
  animation-play-state: paused;
}

.deal-ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
}

.deal-ticker-item:hover .deal-ticker-name {
  text-decoration: underline;
}

.deal-ticker-name {
  color: #ffffff;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-ticker-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 700;
}

.deal-ticker-item--gold .deal-ticker-meta {
  color: #fbbf24;
}

.deal-ticker-item--teal .deal-ticker-meta {
  color: #2dd4bf;
}

.deal-ticker-item--sky .deal-ticker-meta {
  color: #38bdf8;
}

.deal-ticker-arrow {
  font-size: 0.7rem;
  line-height: 1;
}

.deal-ticker-sep {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.55rem;
}

@keyframes deal-ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Quick links */
.quick-links {
  margin-top: var(--space-4);
  padding: 0 var(--space-3) var(--space-3);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
}

.quick-links-heading {
  margin: 0 0 10px;
  padding: 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.quick-links-empty {
  margin: 0;
  padding: 0 4px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.quick-links-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-links-group {
  border-radius: 8px;
}

.quick-links-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0.55rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.quick-links-summary::-webkit-details-marker {
  display: none;
}

.quick-links-summary:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.quick-links-summary .icon {
  color: var(--color-text-muted);
  transition: transform 180ms ease;
}

.quick-links-group[open] > .quick-links-summary .icon:last-child {
  transform: rotate(180deg);
}

.quick-links-summary-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.quick-links-panel {
  padding: 0 0.35rem 0.45rem 0.55rem;
}

.quick-links-sort {
  display: flex;
  justify-content: flex-end;
  padding: 4px 8px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
}

.quick-links-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.quick-links-item:hover {
  background: var(--color-surface-muted);
}

.quick-links-code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-links-dash {
  color: var(--color-text-muted);
}

.quick-links-price {
  margin-left: auto;
  color: var(--color-accent-mid);
  font-weight: 600;
  white-space: nowrap;
}

/* Display preference toggles */
.display-pref-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.display-pref-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--color-border);
}

.display-pref-row:last-child {
  border-bottom: none;
}

.display-pref-copy {
  min-width: 0;
  flex: 1;
}

.display-pref-title {
  margin: 0 0 0.35rem;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.display-pref-desc {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text-secondary);
  max-width: 42rem;
}

.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c5ced8;
  transition: background 180ms ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 180ms ease;
}

.switch input:checked + .switch-track {
  background: #3b82f6;
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--color-accent-mid);
  outline-offset: 2px;
}

.app-shell.promo-off .brand-mark {
  filter: grayscale(0.35);
  opacity: 0.85;
}

.app-shell.promo-off .dash-ann-banner {
  display: none !important;
}
