/* ─────────────────────────────────────────────
   calcifer p2p — components v3
   ───────────────────────────────────────────── */

/* ── buttons ───────────────────────────────── */
.btn-cta {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 60px;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -.1px;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition:
    filter    .16s var(--ease),
    transform .12s var(--ease),
    box-shadow .16s var(--ease);
}
.btn-cta:hover:not(:disabled) { filter: brightness(1.08); box-shadow: var(--sh-accent); }
.btn-cta:active:not(:disabled) { transform: scale(.985); }
.btn-cta:disabled { opacity: .4; cursor: not-allowed; }

/* spinner dentro btn */
.btn-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

/* secondary */
.btn-secondary {
  width: 100%;
  background: var(--surface-3);
  color: var(--text);
  border: none;
  border-radius: 60px;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14.5px;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .15s var(--ease), transform .12s var(--ease);
}
.btn-secondary:hover  { background: var(--surface-4); }
.btn-secondary:active { transform: scale(.985); }

/* icon button */
.btn-icon {
  background: var(--surface-3);
  border: 1px solid var(--border-md);
  color: var(--text-2);
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .14s var(--ease);
  box-shadow: var(--sh-xs);
}
.btn-icon:hover { background: var(--surface-4); color: var(--text); }
.btn-icon .ms { font-size: 18px; }

/* logout */
.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--red-soft);
  color: var(--red);
  border: none;
  border-radius: var(--r-sm);
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--sans);
  transition: all .15s var(--ease);
}
.btn-logout:hover { background: var(--red); color: #fff; }

/* ── cards ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--sh-sm);
}

.card-flat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}

.card-inner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}

/* balance card scura */
.card-dark {
  background: #111114;
  color: #fff;
  border-radius: var(--r-xl);
  padding: 20px;
  position: relative;
  overflow: hidden;
}


/* card interattiva */
.card-action {
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.card-action:hover  { transform: translateY(-1px); box-shadow: var(--sh-md); }
.card-action:active { transform: scale(.99); }

/* ── form fields ───────────────────────────── */
.form-body {
  padding: 16px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field-lbl {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .1px;
  padding-left: 1px;
}

.field-in {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14.5px;
  font-family: var(--sans);
  outline: none;
  transition:
    border-color .16s var(--ease),
    background   .16s var(--ease),
    box-shadow   .16s var(--ease);
}
.field-in::placeholder { color: var(--text-3); }
.field-in:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* password row */
.pwd-row { position: relative; }
.pwd-row .field-in { padding-right: 44px; }
.pwd-eye {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-3);
  display: flex; align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color .14s;
}
.pwd-eye:hover { color: var(--text-2); }
.pwd-eye .ms { font-size: 18px; }

/* error box */
.err-box {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(232,57,42,.14);
  padding: 10px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 7px;
  line-height: 1.4;
}
.err-box.show { display: flex; }
.err-box .ms { font-size: 16px; flex-shrink: 0; }

/* ── badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-accent   { background: var(--accent-soft);  color: var(--accent); }
.badge-green    { background: var(--green-soft);   color: var(--green); }
.badge-red      { background: var(--red-soft);     color: var(--red); }
.badge-amber    { background: var(--amber-soft);   color: var(--amber); }
.badge-neutral  { background: var(--surface-3);    color: var(--text-2); border: 1px solid var(--border-md); }
.badge-dark     { background: var(--text);         color: #fff; }

/* ── chips / filtri ────────────────────────── */
.filter-row {
  display: flex;
  gap: 6px;
  padding: 0 var(--page-px) 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border-md);
  color: var(--text-2);
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  white-space: nowrap;
  letter-spacing: -.1px;
  box-shadow: var(--sh-xs);
  transition: all .15s var(--spring);
}
.chip:hover:not(.active) { color: var(--text); border-color: rgba(0,0,0,.14); transform: translateY(-1px); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--sh-accent);
  animation: chipPop .2s var(--spring);
}
.chip .ms { font-size: 14px; }

/* ── search ────────────────────────────────── */
.search-wrap { padding: 12px var(--page-px); }
.search-in {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  box-shadow: var(--sh-xs);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.search-in::placeholder { color: var(--text-3); }
.search-in:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--sh-sm);
}

/* ── floating tab bar ──────────────────────── */
.tab-item {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 9px 16px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  letter-spacing: -.1px;
  transition: color .2s var(--ease), transform .18s var(--spring), background .2s var(--ease);
  min-width: 56px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.tab-item .ms { font-size: 20px; }
.tab-item:hover:not(.active) { color: var(--text-2); }
.tab-item:active { transform: scale(.92); }
.tab-item.active { color: #fff; background: var(--accent); box-shadow: var(--sh-accent); }
.tab-item.active .ms { font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24; }

/* cta tab + */
.tab-cta {
  flex-shrink: 0;
  width: 44px; height: 44px;
  background: var(--text);
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  transition: transform .18s var(--spring), box-shadow .15s var(--ease);
  cursor: pointer;
  text-decoration: none;
  border: none;
}
.tab-cta:active { transform: scale(.9); }
.tab-cta .ms { font-size: 22px; }

/* ── sidebar ───────────────────────────────── */
.sidebar-logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 28px;
  padding: 0 6px;
}
.sidebar-logo-dot { color: var(--accent); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.sidebar-item .ms { font-size: 18px; flex-shrink: 0; }
.sidebar-item:hover { background: var(--surface-3); color: var(--text); }
.sidebar-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-item.active .ms {
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}
.sidebar-spacer { flex: 1; }

/* ── topbar ────────────────────────────────── */
.topbar-logo {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.4px;
}
.topbar-logo-dot { color: var(--accent); }

.avatar-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -.3px;
  border: 2px solid var(--border-md);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.avatar-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── seg control (auth tabs) ───────────────── */
.seg-wrap { padding: 14px var(--page-px) 0; }
.seg-control {
  display: flex;
  background: var(--surface-3);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--sans);
  color: var(--text-2);
  transition: all .18s var(--ease);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-xs), 0 0 0 1px var(--border);
}

/* ── content header ────────────────────────── */
.content-header {
  padding: 26px var(--page-px) 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* ── list rows ─────────────────────────────── */
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px var(--page-px);
  cursor: pointer;
  transition: background .14s var(--ease);
  text-decoration: none;
  color: inherit;
}
.list-row:hover  { background: var(--surface-2); }
.list-row:active { background: var(--surface-3); }

.list-row-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-2);
}
.list-row-icon .ms { font-size: 18px; }

.list-row-body   { flex: 1; min-width: 0; }
.list-row-title  { font-size: 14.5px; font-weight: 600; letter-spacing: -.1px; }
.list-row-sub    { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.list-row-right  { text-align: right; flex-shrink: 0; }
.list-row-val    { font-family: var(--mono); font-size: 13.5px; font-weight: 700; }

.list-sep { height: 1px; background: var(--border); margin: 0 var(--page-px); }

/* ── loan card ─────────────────────────────── */
.loan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.loan-card:hover  { transform: translateY(-1px); box-shadow: var(--sh-md); }
.loan-card:active { transform: scale(.99); }

/* ── stat tiles ────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--sh-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-val {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1;
}
.stat-lbl {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-top: 3px;
}
.stat-icon { font-size: 14px; color: var(--text-3); margin-bottom: 2px; }

/* ── modal ─────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.modal-overlay.open { opacity: 1; }

.modal-sheet {
  background: var(--surface);
  border-top-left-radius: var(--r-xl);
  border-top-right-radius: var(--r-xl);
  width: 100%; max-width: 480px;
  padding: 0 0 32px;
  transform: translateY(100%);
  transition: transform .34s var(--spring);
  max-height: 85dvh;
  overflow-y: auto;
  box-shadow: 0 -2px 30px rgba(0,0,0,.07);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
  width: 34px; height: 4px;
  background: var(--surface-4);
  border-radius: 2px;
  margin: 12px auto 0;
}

/* ── toast ─────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: calc(var(--nav-h) + 32px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.toast {
  background: rgba(20,20,22,.9);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  animation: toastIn .26s var(--spring) forwards;
  white-space: nowrap;
  letter-spacing: -.1px;
  backdrop-filter: blur(12px);
}
.toast.success .ms { color: #34d368; }
.toast.error   .ms { color: #ff6b6b; }
.toast .ms { font-size: 15px; }
.toast.out { animation: toastOut .2s var(--ease) forwards; }

/* ── skeleton ──────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-3) 0%,
    var(--surface-4) 40%,
    var(--surface-3) 80%
  );
  background-size: 600px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-md);
}

/* ── avatar ────────────────────────────────── */
.avatar {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -.3px;
  flex-shrink: 0;
  width: 36px; height: 36px;
}
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar-xl { width: 68px; height: 68px; font-size: 24px; }

/* ── progress ──────────────────────────────── */
.progress {
  height: 5px;
  background: var(--surface-4);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width .4s var(--ease);
}
.progress-fill.green { background: var(--green); }

/* ── empty state ───────────────────────────── */
.empty-state { text-align: center; padding: 52px var(--page-px); }
.empty-state .ms { font-size: 40px; color: var(--text-3); margin-bottom: 12px; display: block; }
.empty-state h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 5px; letter-spacing: -.2px; }
.empty-state p  { font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* ── auth layout ───────────────────────────── */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px var(--page-px);
  background: var(--bg);
  animation: pageIn .55s var(--smooth) both;
}

.auth-inner {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-brand {
  text-align: center;
  padding: 0 0 20px;
}
.auth-brand-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.6px;
}
.auth-brand-logo-dot { color: var(--accent); }
.auth-brand-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  font-family: var(--mono);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg), 0 0 0 1px var(--border);
  overflow: hidden;
}