/* Reusable components: buttons, chips, cards, inputs, tabs, timer, toasts. */

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 11px;
  font-weight: 600; font-size: 14.5px;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 24px rgba(47, 240, 163, 0.18); }
.btn--primary:hover { background: #5cf6b8; }
.btn--primary:disabled { background: var(--panel-3); color: var(--faint); box-shadow: none; cursor: not-allowed; }
.btn--ghost { background: var(--panel-2); border-color: var(--line-strong); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent-line); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn--block { width: 100%; }
.btn.is-done { border-color: var(--accent-line); color: var(--accent); }

.spinner {
  display: none;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.is-loading .spinner { display: inline-block; }
.is-loading .btn__label { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text-2);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.is-done { color: var(--accent); border-color: var(--accent-line); }
.icon-btn--text { width: auto; padding: 0 9px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.icon-btn--xs { width: 22px; height: 22px; border: 0; background: transparent; border-radius: 6px; }
.icon-btn--xs svg { width: 14px; height: 14px; }
.icon-btn.is-spinning svg { animation: spin 0.8s linear infinite; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  font: 600 11.5px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); background: var(--panel-2);
  white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip--sm { height: 19px; padding: 0 7px; font-size: 10px; align-self: flex-start; }
.chip--accent::before { display: none; }
.chip--accent, .chip[data-status="unlocked"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.chip[data-status="pending_review"] { color: var(--warn); border-color: rgba(255, 181, 71, 0.35); background: var(--warn-soft); }
.chip[data-status="rejected"] { color: var(--danger); border-color: rgba(255, 95, 109, 0.35); background: var(--danger-soft); }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel) 120px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card__title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.card--unlock { border-color: var(--line-strong); }
.card--unlock::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, var(--accent-line), transparent 30%) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  border: 1px solid transparent;
}

/* ---------- Balance ---------- */
.balance { text-align: left; padding: 4px 0 20px; }
.balance__label { font-size: 13px; color: var(--muted); }
.balance__value { display: flex; align-items: baseline; gap: 10px; font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; }
.balance__unit { font-size: 16px; color: var(--sol); font-weight: 600; letter-spacing: 0; }
.balance__usd { color: var(--text-2); font-size: 15px; margin-top: 2px; }
.balance__meta { font-size: 11.5px; color: var(--faint); margin-top: 10px; }
.balance__value.is-flash { animation: flash 0.9s var(--ease); }
@keyframes flash { 0% { color: var(--accent); } 100% { color: inherit; } }

/* ---------- Address rows ---------- */
.addr {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
}
.addr__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.addr__label { font-size: 11.5px; color: var(--muted); }
.addr__value { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr__value--full { white-space: normal; word-break: break-all; line-height: 1.55; flex: 1; font-size: 13px; }
.addr__value .hl { color: var(--accent); font-weight: 700; }
.addr__actions { display: flex; gap: 6px; }
.addr--deposit { align-items: flex-start; }

.qr-pop { display: grid; place-items: center; margin-top: 12px; padding: 14px; border-radius: var(--r); background: #fff; width: max-content; }
.qr-pop img, .deposit__qr img { display: block; image-rendering: pixelated; }

.note { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13.5px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.note svg { width: 18px; height: 18px; color: var(--warn); }

.perks { margin-top: 22px; display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.perks li { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13.5px; }
.perks svg { width: 16px; height: 16px; color: var(--faint); }
.is-unlocked .perks svg { color: var(--accent); }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 6px; align-items: center; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--faint); }
.steps li + li::before { content: ""; width: 22px; height: 1px; background: var(--line-strong); margin-right: 2px; }
.steps__dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 11px; }
.steps li.is-done { color: var(--text-2); }
.steps li.is-done .steps__dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.is-current { color: var(--text); }
.steps li.is-current .steps__dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px rgba(47, 240, 163, 0.35); }

/* ---------- Tabs ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.tab:hover { border-color: var(--line-strong); }
.tab[aria-selected="true"] { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: var(--accent-glow); }
.tab__sym { font-weight: 700; font-size: 14.5px; }
.tab__net { font-size: 11.5px; color: var(--muted); }

/* ---------- Deposit panel ---------- */
.deposit { display: flex; gap: 20px; align-items: flex-start; }
.deposit__qr { flex: none; padding: 10px; border-radius: var(--r); background: #fff; }
.deposit__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.deposit__amount { display: flex; flex-direction: column; }
.deposit__amount-label { font-size: 12.5px; color: var(--muted); }
.deposit__amount .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.deposit__label { font-size: 13.5px; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.hint mark { background: var(--accent-soft); color: var(--accent); padding: 0 4px; border-radius: 4px; }

/* ---------- Banners ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 0; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; }
.banner svg { width: 18px; height: 18px; margin-top: 1px; }
.banner--warn { background: var(--warn-soft); color: #ffd79a; border: 1px solid rgba(255, 181, 71, 0.25); }
.banner--warn svg { color: var(--warn); }
.banner--danger { background: var(--danger-soft); color: #ffc2c8; border: 1px solid rgba(255, 95, 109, 0.3); margin: 0 0 18px; }
.banner--danger svg { color: var(--danger); }

/* ---------- Forms ---------- */
.declare { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.declare__details { display: grid; gap: 14px; }
.declare__details[hidden] { display: none; }
.declare__title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.declare__title svg { width: 16px; height: 16px; color: var(--accent); }
.field-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 5fr); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.field__aside { color: var(--warn); }
.input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 240, 163, 0.15); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 46px; }
.icon-btn--inset { position: absolute; right: 5px; top: 5px; border: 0; background: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.form-error { color: var(--danger); font-size: 13.5px; }

/* ---------- Review timer ---------- */
.timer { display: flex; gap: 24px; align-items: center; }
.ring { position: relative; width: 168px; height: 168px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring__track { stroke: var(--line); }
.ring__bar {
  stroke: var(--accent); stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0));
  filter: drop-shadow(0 0 6px rgba(47, 240, 163, 0.45));
  transition: stroke-dashoffset 1s linear;
}
.ring.is-overdue .ring__bar { stroke: var(--warn); filter: drop-shadow(0 0 6px rgba(255, 181, 71, 0.45)); }
.ring__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__time { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.ring__caption { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.timer__copy { display: grid; gap: 8px; font-size: 14px; }
.timer__headline { font-size: 17px; font-weight: 600; }

.receipt { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 22px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.receipt > div { background: var(--surface); padding: 12px 14px; min-width: 0; }
.receipt dt { font-size: 11.5px; color: var(--muted); }
.receipt dd { font-size: 13.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timeline { margin-top: 22px; display: grid; gap: 14px; position: relative; }
.timeline li { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--faint); }
.timeline__dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.timeline li.is-done { color: var(--text-2); }
.timeline li.is-done .timeline__dot { background: var(--accent); border-color: var(--accent); }
.timeline li.is-active { color: var(--text); }
.timeline li.is-active .timeline__dot { border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); animation: pulse 2s ease-in-out infinite; }

/* ---------- Unlocked ---------- */
.success__badge { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); box-shadow: var(--accent-glow); }
.success__badge svg { width: 30px; height: 30px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--panel-3); border: 1px solid var(--line-strong);
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.25s var(--ease);
}
.toast svg { width: 16px; height: 16px; color: var(--accent); }
.toast--warn svg { color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive components ---------- */
@media (max-width: 640px) {
  .card { padding: 18px; border-radius: var(--r-lg); }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .deposit { flex-direction: column; }
  .deposit__qr { align-self: center; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .timer { flex-direction: column; text-align: center; }
  .receipt { grid-template-columns: minmax(0, 1fr); }
  .balance__value { font-size: 34px; }
  .steps span:not(.steps__dot) { display: none; }
}
