*,*::before,*::after {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  background: #010A0F;
  color: #eaeaea;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

.card-shell {
  background: #1e293b;
  border: 2px solid #4f46e5;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(99,102,241,0.2);
  overflow: hidden;
}

.mode-tabs {
  display: flex;
  width: 100%;
  background: #0f172a;
  border-bottom: 1px solid rgba(99,102,241,0.35);
}

.mode-tab {
  flex: 1;
  padding: 0.8rem 0.5rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s,color 0.15s;
}

.mode-tab+.mode-tab {
  border-left: 1px solid rgba(99,102,241,0.35);
}

.mode-tab:hover {
  background: rgba(99,102,241,0.10);
  color: #eaeaea;
}

.mode-tab.active {
  background: rgba(99,102,241,0.18);
  color: #eaeaea;
}

.swap-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 1.5rem;
  max-width: none;
  width: 100%;
  box-shadow: none;
}

.section {
  margin-bottom: 1.25rem;
}

.section:last-child {
  margin-bottom: 0;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  background: rgba(99,102,241,0.3);
  border: 1px solid rgba(99,102,241,0.5);
  border-radius: 50%;
  font-size: 0.55rem;
  color: #818cf8;
  cursor: pointer;
  margin-left: 0.15rem;
  transition: all 0.2s;
  user-select: none;
  position: relative;
  z-index: 1;
}

.info-icon:hover {
  background: rgba(99,102,241,0.5);
  transform: scale(1.2);
  z-index: 1001;
}

.tooltip-container {
  position: relative;
}

.tooltip {
  position: absolute;
  bottom: calc(100%+4px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid #4f46e5;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  color: #cbd5e1;
  white-space: normal;
  width: 180px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
}

.tooltip::after {
  display: none;
}

.tooltip-container:hover .tooltip {
  opacity: 1;
  z-index: 10000;
}

.tooltip-container.active .tooltip {
  opacity: 1;
  pointer-events: auto;
  z-index: 10000;
}

.context-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.affiliate-toggle-container {
  background: rgba(99,102,241,0.1);
  border-radius: 10px;
  padding: 0.65rem;
}

.toggle-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.toggle-option {
  flex: 1;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-option-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.toggle-option small {
  font-size: 0.65rem;
}

.toggle-active-1 {
  background: #23b848;
  color: #fff;
  font-weight: bold;
}

.toggle-active-2 {
  background: #1004f7;
  color: #fff;
  font-weight: bold;
}

.toggle-inactive {
  background: transparent;
  color: #64748b;
}

.toggle-disabled {
  background: transparent;
  color: #475569;
  opacity: 0.4;
  cursor: not-allowed;
}

.toggle-slider {
  width: 38px;
  height: 22px;
  background: #4f46e5;
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
}

.toggle-slider.affiliate-2::after {
  transform: translateX(16px);
}

.toggle-slider:hover {
  background: #6366f1;
}

.toggle-slider.disabled {
  background: #475569;
  cursor: not-allowed;
  opacity: 0.5;
}

.toggle-slider.disabled:hover {
  background: #475569;
}

.active-vault-pill {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  font-size: 0.7rem;
  color: #818cf8;
  margin-top: 0.65rem;
  word-break: break-all;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}
.vault-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;

}.vault-pill-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;
}

.vault-pill-address {
  font-size: 0.65rem;
  word-break: break-all;
  opacity: 0.9;
}

.constraints-container {
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 10px;
  position: relative;
  overflow: visible;
}

.constraints-header {
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
  border-radius: 10px 10px 0 0;
}

.constraints-header:hover {
  background: rgba(99,102,241,0.1);
}

.constraints-title {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
}

.expand-icon {
  font-size: 0.7rem;
  color: #64748b;
  transition: transform 0.2s;
}

.constraints-container.expanded .expand-icon {
  transform: rotate(180deg);
}

.constraints-preview {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 0.5rem;
  padding: 0 0.6rem 0.5rem 0.6rem;
}

.preview-item {
  text-align: center;
}

.preview-label {
  font-size: 0.6rem;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.preview-value {
  font-size: 0.85rem;
  font-weight: bold;
  color: #818cf8;
}

.constraints-body {
  display: none;
}

.constraints-container.expanded .constraints-body {
  display: block;
}

.constraints-container.expanded .constraints-preview {
  display: none;
}

.constraints-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 0;
  padding: 0.5rem 0.4rem 0.6rem 0.4rem;
  border-top: 1px solid rgba(99,102,241,0.2);
}

.constraint-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.15rem;
}

.constraint-item:not(:last-child) {
  border-right: 1px solid rgba(99,102,241,0.2);
}

.constraint-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #94a3b8;
  position: relative;
  z-index: 1;
}

.input-wrapper {
  position: relative;
  width: 80%;
}

.constraint-input {
  width: 100%;
  padding: 0.35rem 0.85rem 0.35rem 0.3rem;
  background: #0b0e11;
  border: 2px solid #4f46e5;
  border-radius: 6px;
  color: #eaeaea;
  text-align: center;
  font-size: 0.75rem;
}

.arrows-overlay {
  position: absolute;
  right: 0;
  transform: translateX(-2px);
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 14px;
}

.arrow-overlay {
  flex: 1;
  background: transparent;
  border: none;
  color: #818cf8;
  cursor: pointer;
  font-size: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.arrow-overlay:hover {
  background: rgba(99,102,241,0.3);
  color: #fff;
}

.arrow-overlay:first-child {
  border-radius: 0 4px 0 0;
}

.arrow-overlay:last-child {
  border-radius: 0 0 4px 0;
}

.swap-form {
  background: rgba(15,23,42,0.4);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: left;
  width: 20%;
}

.form-select,.form-input {
  padding: 0.65rem;
  background: #0f172a;
  border: 1px solid rgba(99,102,241,0.45);
  border-radius: 8px;
  color: #eaeaea;
  font-size: 0.95rem;
}

.flip-button {
  align-self: center;
  width: 36px;
  height: 36px;
  background: #4f46e5;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  top: 9px;
}

.flip-tooltip {
  align-self: center;
}

.flip-tooltip .tooltip {
  width: 140px;
  text-align: center;
}

.flip-button:hover {
  background: #6366f1;
}

.outcome-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.info-row {
  font-size: 0.85rem;
  color: #94a3b8;
}

.info-row strong {
  color: #eaeaea;
}

.button-group {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.4rem;
}

.outcome-section .btn-primary {
  width: 100%;
}

.btn {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #6366f1;
  color: white;
}

.btn-primary:hover {
  background: #4f46e5;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(99,102,241,0.2);
  color: #818cf8;
}

.btn-secondary:hover {
  background: rgba(99,102,241,0.3);
}

@media(max-width:520px) {
  .swap-card {
    padding: 1.25rem;
  }

  .toggle-option {
    font-size: 0.7rem;
  }

  .toggle-option small {
    font-size: 0.6rem;
  }
}

input[type="number"]::-webkit-outer-spin-button,input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
