@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-color: #dcdce4;
  --surface-color: #ececf2;
  --surface-hover: #f5f5f8;
  --surface-light: #d0d0da;
  --text-primary: #1c1c24;
  --text-secondary: #5a5a68;
  --accent-color: #1c1c24;
  --border-color: #babac6;
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(28, 28, 36, 0.1);
  --page-base: #d4d4dc;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
  background-color: var(--page-base);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0.75rem 1.25rem 0.75rem;
  padding-top: max(3.75rem, calc(env(safe-area-inset-top, 0px) + 3rem));
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

main.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  min-height: calc(100dvh - 4.75rem);
  display: flex;
  flex-direction: column;
}

.app-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1;
  gap: 1.5rem;
  max-width: 1100px;
  width: 100%;
  min-height: 0;
  animation: fadeIn 1s cubic-bezier(0.23, 1, 0.32, 1);
}

.calc-section, .steps-section {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.calculator {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  gap: 0.85rem;
}

.calculator.steps-card {
  justify-content: flex-start;
  gap: 0.5rem;
}

/* Nav & Account Button */
.top-nav {
  position: fixed;
  top: 0.65rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.nav-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem 0.65rem;
  max-width: min(100vw - 1.5rem, 640px);
}

/* На случай если браузер оставляет [hidden] со стилем display:none */
.nav-user-email:not([hidden]) {
  display: inline-block;
}

.nav-user-email {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: min(11rem, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.nav-home-link {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-light);
  white-space: nowrap;
}

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

.nav-balance:not([hidden]) {
  display: inline-block;
}

.nav-balance-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-balance-pending {
  display: inline-flex;
  align-items: center;
  color: rgba(212, 168, 0, 0.95);
}

.nav-balance-pending[hidden] {
  display: none !important;
}

.nav-balance-pending-svg {
  display: block;
  flex-shrink: 0;
}

.nav-balance-group {
  display: inline-flex;
  align-items: stretch;
}

.nav-balance {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 0.38rem 0.62rem;
  white-space: nowrap;
}

.nav-balance-add {
  width: 30px;
  height: auto;
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
  background: #f1c40f;
  color: #1c1c24;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.nav-balance-add:hover {
  filter: brightness(0.96);
}

.nav-sign-out {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-sign-out:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.nav-withdraw {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 0, 0.55);
  background: rgba(212, 168, 0, 0.12);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease, filter 0.2s ease;
}

.nav-withdraw:hover {
  filter: brightness(1.03);
  background: rgba(212, 168, 0, 0.2);
}

.nav-withdraw[hidden] {
  display: none !important;
}

/* Узкие экраны: навбар колонкой + сетка, без налезания */
@media (max-width: 640px) {
  .top-nav {
    left: 0.35rem;
    right: 0.35rem;
    align-items: stretch;
    gap: 0.4rem;
  }

  .nav-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'lang lang'
      'account account'
      'balance balance'
      'email email'
      'withdraw signout';
    align-items: stretch;
    max-width: none;
    width: 100%;
    gap: 0.35rem;
    column-gap: 0.35rem;
    row-gap: 0.35rem;
  }

  .nav-controls > .lang-switcher {
    grid-area: lang;
    justify-self: end;
  }

  .nav-controls > .account-btn {
    grid-area: account;
    width: 100%;
    max-width: none;
    font-size: 0.62rem;
    padding: 0.42rem 0.5rem;
    letter-spacing: 0.04em;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .nav-controls > .nav-balance-group {
    grid-area: balance;
    width: 100%;
    max-width: none;
  }

  .nav-controls > #nav-user-email {
    grid-area: email;
    max-width: none;
    width: 100%;
    text-align: center;
    font-size: 0.65rem;
  }

  .nav-controls > #nav-withdraw {
    grid-area: withdraw;
    width: 100%;
    font-size: 0.62rem;
    padding: 0.34rem 0.35rem;
  }

  .nav-controls > #nav-sign-out {
    grid-area: signout;
    width: 100%;
    font-size: 0.62rem;
    padding: 0.34rem 0.35rem;
  }

  .nav-balance {
    font-size: 0.64rem;
    padding: 0.32rem 0.45rem;
    min-width: 0;
    flex: 1;
  }

  .nav-balance-inner {
    max-width: 100%;
  }

  #nav-balance-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-balance-add {
    width: 32px;
    min-width: 32px;
    flex-shrink: 0;
    font-size: 0.95rem;
  }

  .lang-btn {
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  .support-float.left {
    top: auto;
    bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    left: 0.35rem;
    max-width: calc(100vw - 0.9rem);
    padding: 0.38rem 0.55rem;
  }

  .support-float.left .support-text {
    display: none;
  }

  .support-float.left .support-icon {
    width: 26px;
    height: 26px;
  }
}

.lang-switcher {
  display: flex;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 5px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--text-primary);
  color: #fff;
}

.account-btn {
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  overflow: visible;
}

.account-btn:hover {
  background: var(--text-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(28, 28, 36, 0.18);
}

/* Sparkle Effect */
.sparks {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
}

.account-btn:hover .spark {
  animation: sparkBurst 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes sparkBurst {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.spark:nth-child(1) { --tx: -50px; --ty: -30px; animation-delay: 0s; }
.spark:nth-child(2) { --tx: 50px; --ty: -40px; animation-delay: 0.05s; }
.spark:nth-child(3) { --tx: -40px; --ty: 40px; animation-delay: 0.1s; }
.spark:nth-child(4) { --tx: 30px; --ty: 50px; animation-delay: 0.15s; }
.spark:nth-child(5) { --tx: -60px; --ty: 10px; animation-delay: 0.02s; }
.spark:nth-child(6) { --tx: 40px; --ty: -60px; animation-delay: 0.08s; }
.spark:nth-child(7) { --tx: 60px; --ty: 30px; animation-delay: 0.12s; }
.spark:nth-child(8) { --tx: -20px; --ty: -50px; animation-delay: 0.03s; }

/* Floating Support Button */
.support-float {
  position: fixed;
  top: 0.65rem;
  left: 1rem;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 0 8px 28px rgba(28, 28, 36, 0.12);
}

.support-float:hover {
  background: var(--surface-hover);
  border-color: var(--text-secondary);
  transform: translateY(-5px);
}

.support-icon {
  width: 28px;
  height: 28px;
  background: var(--surface-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
}

.support-text {
  display: flex;
  flex-direction: column;
}

.support-text span {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--text-primary);
}

.support-text small {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.035;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.waves-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: var(--page-base);
}

.waves-bg canvas {
  pointer-events: none;
  display: block;
  width: 100%;
  height: 100%;
  vertical-align: middle;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Calculator Grid */
.calculator {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.1rem 1.15rem;
  box-shadow: 0 16px 40px rgba(28, 28, 36, 0.08), 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.display {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 2.05rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  text-align: left;
  padding: 0.15rem 0;
  outline: none;
  cursor: default;
  line-height: 1.15;
}

.input-group {
  margin-bottom: 0; /* Managed by grid gap now */
}

.input-group label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.main-input {
  width: 100%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--text-primary);
  font-size: 1.32rem;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: all 0.3s ease;
}

.main-input:focus {
  border-color: var(--text-primary);
  background: var(--surface-hover);
}

.error-msg {
  display: none;
  color: #b71c1c;
  font-size: 0.68rem;
  margin-top: 0.2rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

.error-msg.visible {
  display: block;
}

.months-control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface-color);
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.months-control input {
  width: 48px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.22rem;
  font-family: 'Outfit', sans-serif;
  text-align: center;
  outline: none;
}

.control-btn {
  width: 36px;
  height: 36px;
  background: var(--surface-hover);
  border-radius: 7px;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.22rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: var(--text-primary);
  color: #fff;
}

.unit {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-left: 0.25rem;
}

.display-container {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.display-container label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.topup-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.35rem;
  width: 100%;
}

.topup-btn-stack .topup-btn {
  margin-top: 0;
}

.topup-btn {
  background: #d4a800;
  color: #141414;
  border: none;
  padding: 0.85rem 1.05rem;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 0.35rem;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.topup-btn:hover {
  background: #e8bc1a;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(180, 140, 0, 0.25);
}

.topup-btn:active {
  transform: scale(0.98);
}

.calc-top {
  flex-shrink: 0;
}

.calc-insights {
  flex: 1 1 auto;
  min-height: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.5rem 0;
  border-top: 1px dashed rgba(28, 28, 36, 0.12);
  border-bottom: 1px dashed rgba(28, 28, 36, 0.12);
  margin: 0.15rem 0;
}

.calc-insights-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.calc-insights-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  font-weight: 600;
}

.calc-rate-pill {
  font-size: 0.66rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.calc-profit-line {
  font-family: 'Outfit', sans-serif;
  font-size: 1.48rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.calc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.calc-pill {
  font-size: 0.66rem;
  padding: 0.28rem 0.5rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.calc-footnote {
  font-size: 0.66rem;
  line-height: 1.42;
  color: var(--text-secondary);
  opacity: 0.92;
}

/* Hide arrows for number inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Steps Styling */
.steps-path {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.steps-card .steps-path {
  flex: 1 1 auto;
  justify-content: space-between;
  min-height: 0;
  gap: 0.45rem;
}

.step {
  display: flex;
  gap: 0.75rem;
  position: relative;
}

.step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 32px;
  flex-shrink: 0;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--text-primary);
  z-index: 2;
  transition: all 0.3s ease;
}

.step:hover .step-number {
  border-color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(28, 28, 36, 0.12);
}

.step-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.048em;
  margin-bottom: 0.2rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.step-content p {
  font-size: 0.86rem;
  line-height: 1.48;
  color: var(--text-secondary);
}

.step-content small {
  display: block;
  margin-top: 0.25rem;
  color: #6b6b78;
  line-height: 1.45;
  font-size: 0.8rem;
}

/* Responsive Layout */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    padding: 0.5rem 0;
    flex: none;
  }

  main.container {
    min-height: 0;
  }
  
  .calc-section, .steps-section {
    width: 100%;
    max-width: 450px;
  }

  .calculator {
    flex: none;
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .calculator.steps-card .steps-path {
    flex: none;
    justify-content: flex-start;
    gap: 0.85rem;
  }
  
  body {
    padding: 0.65rem 1rem;
    padding-top: max(3.6rem, calc(env(safe-area-inset-top, 0px) + 2.85rem));
    overflow-y: auto;
  }

  .steps-path {
    gap: 0.85rem;
  }

  .step-content p {
    font-size: 0.88rem;
  }
}

/* Узкий телефон: больше места под двухрядный навбар (перебивает padding из блока 900px) */
@media (max-width: 640px) {
  body {
    padding-top: max(5.5rem, calc(env(safe-area-inset-top, 0px) + 4.75rem));
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Custom Scrollbar for potential future content */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

/* Макет окна входа (без класса .calculator — иначе тянется flex:1 на весь экран) */
/* Важно: без этого display:flex перебивает атрибут hidden — окно висит всегда и «Закрыть» не помогает */
.auth-modal-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(28, 28, 36, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  visibility: visible;
}

.auth-modal-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: min(90dvh, 520px);
  overflow-y: auto;
  padding: 1.35rem 1.25rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(28, 28, 36, 0.08), 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.auth-modal-x {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--surface-light);
  color: var(--text-primary);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.auth-modal-x:hover {
  background: var(--surface-hover);
}

.auth-modal-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  margin: 0 2rem 0 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.auth-modal-demo {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.auth-modal-send-error {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  line-height: 1.4;
  color: #b71c1c;
}

.auth-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-modal-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.auth-modal-input {
  margin-bottom: 0.35rem;
}

.auth-modal-submit {
  width: 100%;
}

.auth-modal-close {
  margin-top: 0.15rem;
  width: 100%;
  padding: 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--surface-light);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-modal-close:hover {
  background: var(--surface-hover);
}

/* BTC payment instructions (same overlay pattern as auth modal) */
.btc-pay-modal-panel {
  max-width: 520px;
}

.btc-pay-rows {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btc-pay-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.btc-pay-row-stack {
  flex-direction: column;
  align-items: stretch;
}

.btc-pay-addr-line {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.35rem;
}

.btc-pay-addr-line .btc-pay-addr {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  cursor: pointer;
}

.btc-pay-clip-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btc-pay-clip-btn:hover {
  border-color: rgba(28, 28, 36, 0.35);
  background: var(--surface-light);
}

.btc-pay-network-msg {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btc-pay-addr {
  display: block;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.8rem;
  word-break: break-all;
  white-space: pre-wrap;
}

.btc-pay-rate-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btc-pay-claim-hint {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.btc-pay-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btc-pay-btn-secondary {
  background: var(--surface-light) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.withdraw-modal-panel {
  max-width: 480px;
}

.withdraw-available-line {
  margin-top: 0.25rem;
}

.withdraw-network-hint {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Toast после «Я оплатил» */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%) translateY(130%);
  z-index: 2001;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.9rem 1.15rem;
  border-radius: 12px;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.22);
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.app-toast.app-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
