* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  font-family: system-ui, sans-serif;
  background: radial-gradient(circle at top, #0f3d3e, #071b1f);
  color: #eaf6f6;

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  background: rgba(15, 61, 62, 0.95);
  padding: 28px;
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
}

h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7ecac5;
  margin: 0 0 8px;
}

/* ===== Form elements ===== */
label {
  display: block;
  text-align: left;
  font-size: 13px;
  color: #a0ccc8;
  margin-bottom: 4px;
  margin-top: 8px;
}

input, button {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
}

input {
  background: rgba(255, 255, 255, 0.1);
  color: #eaf6f6;
}

input::placeholder {
  color: rgba(234, 246, 246, 0.4);
}

input:focus {
  outline: 2px solid #4fd1c5;
  outline-offset: -2px;
}

input[type="date"] {
  color-scheme: dark;
}

button {
  background: linear-gradient(135deg, #4fd1c5, #38b2ac);
  color: #003333;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

button:active {
  opacity: 0.85;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary {
  background: transparent;
  border: 1px solid #4fd1c5;
  color: #4fd1c5;
}

.hidden {
  display: none !important;
}

.mensagem {
  min-height: 20px;
  color: #ff6b6b;
  font-size: 14px;
}

.mensagem.success {
  color: #68d391;
}

/* ===== Links ===== */
.link-text {
  font-size: 14px;
  color: #a0ccc8;
  margin-top: 8px;
}

.link {
  color: #4fd1c5;
  text-decoration: none;
  font-weight: 600;
}

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

.info-text {
  font-size: 14px;
  color: #b0d8d4;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ===== Code input (verification) ===== */
.code-input {
  font-size: 28px;
  letter-spacing: 8px;
  text-align: center;
  font-weight: bold;
}

/* ===== Header bar (home) ===== */
.header-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.icon-btn {
  width: auto;
  background: transparent;
  color: #eaf6f6;
  font-size: 22px;
  padding: 8px 12px;
  margin-bottom: 0;
  border-radius: 8px;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.addr-chip {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  color: #7ecac5;
  background: rgba(79, 209, 197, 0.1);
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

/* ===== Empty state ===== */
.empty-state {
  padding: 20px 0;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state h2 {
  margin-bottom: 8px;
}

/* ===== Mode Switch (toggle depósito/saque) ===== */
.mode-switch {
  margin-bottom: 18px;
}

.switch-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
}

.switch-track {
  position: relative;
  width: 48px;
  height: 26px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  transition: background 0.25s ease;
  flex-shrink: 0;
}

.switch-track.active {
  background: #4fd1c5;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
}

.switch-track.active .switch-thumb {
  transform: translateX(22px);
}

/* ===== Valor mode switch (small, for saque) ===== */
.valor-mode-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.small-switch {
  justify-content: flex-start;
  font-size: 14px;
  gap: 8px;
}

.small-switch .switch-track {
  width: 40px;
  height: 22px;
}

.small-switch .switch-thumb {
  width: 16px;
  height: 16px;
}

.small-switch .switch-track.active .switch-thumb {
  transform: translateX(18px);
}

.valor-mode-text {
  font-size: 13px;
  opacity: 0.85;
}

.hint {
  font-size: 12px;
  opacity: 0.6;
  margin: 0 0 14px;
  line-height: 1.5;
  text-align: left;
}

/* ===== Resultado Saque ===== */
.resultado-titulo {
  font-size: 17px;
  font-weight: 600;
  color: #4fd1c5;
  margin: 0 0 14px;
}

.resultado-valores {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  width: 100%;
}

.resultado-item {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.resultado-label {
  display: block;
  font-size: 11px;
  opacity: 0.6;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.resultado-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

.resultado-sublabel {
  font-size: 13px;
  opacity: 0.7;
  margin: 0 0 8px;
}

.address-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  word-break: break-all;
  font-family: monospace;
  font-size: 13px;
}

.address-text {
  opacity: 0.9;
}

.qr-hint {
  font-size: 12px;
  opacity: 0.5;
  margin-top: 10px;
}

#saqueQr {
  width: 100%;
  max-width: min(220px, 60vw);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 12px 0 0;
  object-fit: contain;
  border-radius: 8px;
}

/* ===== Menu overlay ===== */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
}

.menu-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.menu-panel {
  position: relative;
  width: 280px;
  max-width: 80vw;
  background: #0d3233;
  padding: 24px;
  height: 100%;
  overflow-y: auto;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.menu-header h2 {
  margin: 0;
}

.menu-section {
  margin-bottom: 24px;
}

.menu-item {
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  padding: 12px 16px;
  font-size: 15px;
  color: #eaf6f6;
  margin-bottom: 6px;
}

.menu-item:active {
  background: rgba(255, 255, 255, 0.12);
}

.menu-item.danger {
  color: #ff6b6b;
}

.menu-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}

.modal.hidden {
  display: none !important;
}

.modal-box {
  background: #0f3d3e;
  padding: 24px;
  border-radius: 16px;
  width: 90%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
}

/* ===== Address list (select modal) ===== */
.addr-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.addr-list-item:hover,
.addr-list-item:active {
  background: rgba(255, 255, 255, 0.12);
}

.addr-list-item.selected {
  border: 2px solid #4fd1c5;
  background: rgba(79, 209, 197, 0.1);
}

.addr-list-item .addr-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #4fd1c5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.addr-list-item.selected .addr-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4fd1c5;
}

.addr-list-item .addr-text {
  font-family: monospace;
  font-size: 13px;
  color: #b0d8d4;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.addr-list-item .addr-delete {
  color: #ff6b6b;
  background: transparent;
  width: auto;
  padding: 4px 8px;
  font-size: 16px;
  margin: 0;
  border-radius: 6px;
}

/* ===== QR Result (depósito) ===== */
#resultado {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#qrImage {
  width: 100%;
  max-width: min(280px, 80vw);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 16px 0;
  object-fit: contain;
}

/* ===== Install button ===== */
.install-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 14px;
  background: #38b2ac;
  color: #003333;
  width: auto;
  max-width: none;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
}

.toast.hidden {
  display: none;
}

@supports (-webkit-touch-callout: none) {
  .toast {
    bottom: 32px;
  }
}
