/* ===========================================================================
   Components — buttons, inputs, nav, sheets, toasts, list rows, chips, PIN
   =========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 52px; padding: 0 var(--s-6);
  border-radius: var(--r-pill);
  font-size: var(--fs-md); font-weight: var(--fw-semibold);
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast), filter var(--t-fast);
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.block { display: flex; width: 100%; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(0.92); }

.btn-secondary { background: var(--glass-bg-2); color: var(--text); border: 1px solid var(--glass-border); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-gold { background: var(--plt-gold); color: #FFFFFF; }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-success { background: var(--color-success); color: #04210f; }
.btn-sm { height: 40px; padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn-lg { height: 58px; font-size: var(--fs-lg); }

/* Icon button */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text); font-size: var(--fs-lg);
  transition: transform var(--t-fast), background var(--t-fast);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.plain { background: transparent; border: none; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.card.glass { background: var(--glass-bg); }
.section { padding: var(--s-3) var(--s-5); }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
  margin: var(--s-5) var(--s-5) var(--s-3);
}
.section-title a { color: var(--text-muted); font-size: var(--fs-sm); text-transform: none; letter-spacing: 0; }

/* ---------- Chips / pills / segmented ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 34px; padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted);
  transition: all var(--t-fast);
}
.chip.active { background: var(--text); color: var(--bg); border-color: transparent; }

.segmented {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--r-pill);
}
.segmented button {
  flex: 1; height: 38px; padding: 0 var(--s-4); border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted);
  transition: all var(--t-fast) var(--ease-out);
}
.segmented button.active { background: var(--text); color: var(--bg); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.badge.gold { background: var(--plt-gold-soft); color: var(--plt-gold); border-color: var(--plt-gold-line); }
.badge.success { background: rgba(34,197,94,0.14); color: var(--color-success); border-color: rgba(34,197,94,0.4); }
.badge.error { background: rgba(239,68,68,0.14); color: var(--color-error); border-color: rgba(239,68,68,0.4); }
.badge.warn { background: rgba(245,158,11,0.14); color: var(--color-warning); border-color: rgba(245,158,11,0.4); }
.badge.muted { color: var(--text-muted); }
.badge.coming { background: transparent; color: var(--text-faint); border-style: dashed; }

/* ---------- Inputs ---------- */
.field { margin-bottom: var(--s-4); }
.field > label { display: block; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); margin-bottom: var(--s-2); }
.input, .select, textarea.input {
  width: 100%; height: 54px; padding: 0 var(--s-4);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text); font-size: var(--fs-md);
  transition: border-color var(--t-fast), background var(--t-fast);
}
textarea.input { height: auto; min-height: 92px; padding: var(--s-3) var(--s-4); resize: vertical; }
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--text); background: var(--surface-3);
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group .prefix, .input-group .suffix {
  position: absolute; color: var(--text-muted); font-size: var(--fs-md); pointer-events: none;
}
.input-group .prefix { left: var(--s-4); }
.input-group .suffix { right: var(--s-4); }
.input-group .input.with-prefix { padding-left: 38px; }
.field .hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 6px; }
.field .hint.error { color: var(--color-error); }

/* Switch */
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border); transition: var(--t-base);
}
.switch .track::before {
  content: ''; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px;
  border-radius: 50%; background: var(--text-muted); transition: var(--t-base) var(--ease-out);
}
.switch input:checked + .track { background: var(--color-success); border-color: transparent; }
.switch input:checked + .track::before { transform: translateX(18px); background: #fff; }

/* ---------- List rows ---------- */
.list { padding: 0 var(--s-3); }
.row-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3); border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.row-item:active { background: var(--glass-bg); }
.row-item .lead {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: var(--fs-lg);
  background: var(--surface-2); border: 1px solid var(--border-soft);
}
.row-item .lead.credit { color: var(--color-success); }
.row-item .lead.debit { color: var(--text); }
.row-item .body { flex: 1; min-width: 0; }
.row-item .body .title { font-weight: var(--fw-medium); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .body .sub { font-size: var(--fs-sm); color: var(--text-muted); }
.row-item .trail { text-align: right; flex: none; }
.row-item .trail .amt { font-weight: var(--fw-semibold); }
.row-item .trail .time { font-size: var(--fs-xs); color: var(--text-faint); }
.divider { height: 1px; background: var(--divider); margin: var(--s-2) var(--s-3); }

/* ---------- Bottom navigation (liquid pill) ---------- */
.bottom-nav {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 14px);
  z-index: 50;
  display: flex; align-items: center; gap: 2px;
  padding: 8px;
  width: calc(100% - 32px); max-width: 440px;
  border-radius: var(--r-pill);
  background: var(--glass-bg-2);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--glass-shadow);
}
.bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  height: 52px; justify-content: center; border-radius: var(--r-pill);
  color: var(--text-faint); font-size: 18px;
  transition: color var(--t-fast), background var(--t-base) var(--ease-out);
  position: relative;
}
.bottom-nav button .lbl { font-size: 10px; font-weight: var(--fw-medium); letter-spacing: 0.02em; }
.bottom-nav button.active { color: var(--accent-text); background: var(--accent); }
.bottom-nav button.active .lbl { font-weight: var(--fw-semibold); }
.bottom-nav button .dot {
  position: absolute; top: 8px; right: 50%; margin-right: -14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--color-error);
}

/* ---------- Floating Friday button ---------- */
.fab-friday {
  position: absolute; right: 18px; z-index: 45;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 28px);
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-size: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 0 1px var(--glass-border);
  transition: transform var(--t-fast);
}
.fab-friday:active { transform: scale(0.9); }
.fab-friday::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--glass-border); opacity: 0.6;
  animation: pulse-ring 2.4s var(--ease-out) infinite;
}
@keyframes pulse-ring { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.4); opacity: 0; } }

/* ---------- Quick actions grid ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); padding: 0 var(--s-5); }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding: var(--s-3) 0;
}
.quick-action .qa-icon {
  width: 54px; height: 54px; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: var(--fs-xl);
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text);
  transition: transform var(--t-fast), background var(--t-fast);
}
.quick-action:active .qa-icon { transform: scale(0.92); background: var(--glass-bg-2); }
.quick-action .qa-label { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- Bottom sheet / modal ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; animation: fade-in var(--t-base) forwards;
}
@keyframes fade-in { to { opacity: 1; } }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: var(--app-max-w);
  background: var(--surface); border-top-left-radius: var(--r-xl); border-top-right-radius: var(--r-xl);
  border-top: 1px solid var(--glass-border);
  padding: var(--s-3) var(--s-5) calc(var(--s-6) + var(--safe-bottom));
  max-height: 88dvh; overflow-y: auto;
  animation: sheet-up var(--t-slow) var(--ease-out);
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet .grabber { width: 38px; height: 4px; border-radius: var(--r-pill); background: var(--border); margin: 4px auto var(--s-4); }
.sheet h2 { font-size: var(--fs-xl); font-weight: var(--fw-bold); margin-bottom: var(--s-2); }

/* center dialog variant */
.dialog {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(100% - 48px); max-width: 380px;
  background: var(--surface); border: 1px solid var(--glass-border);
  border-radius: var(--r-xl); padding: var(--s-6);
  animation: pop var(--t-base) var(--ease-out);
}
@keyframes pop { from { transform: translate(-50%,-50%) scale(0.9); opacity: 0; } to { transform: translate(-50%,-50%) scale(1); opacity: 1; } }

/* ---------- Toast ---------- */
.toast-host { position: absolute; left: 0; right: 0; top: 14px; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--s-3);
  max-width: calc(100% - 32px);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow); font-size: var(--fs-sm);
  animation: toast-in var(--t-base) var(--ease-out);
}
.toast.success { border-color: rgba(34,197,94,0.5); }
.toast.error { border-color: rgba(239,68,68,0.5); }
.toast i { font-size: var(--fs-md); }
@keyframes toast-in { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- PIN / OTP pad ---------- */
.pin-dots { display: flex; gap: var(--s-3); justify-content: center; margin: var(--s-6) 0; }
.pin-dots .dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--text-muted); transition: all var(--t-fast);
}
.pin-dots .dot.filled { background: var(--text); border-color: var(--text); }
.pin-dots.error .dot { border-color: var(--color-error); animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); max-width: 300px; margin: 0 auto; }
.keypad button {
  height: 64px; border-radius: var(--r-md); font-size: var(--fs-2xl); font-weight: var(--fw-medium);
  background: var(--glass-bg); border: 1px solid var(--border-soft); color: var(--text);
  transition: transform var(--t-fast), background var(--t-fast);
}
.keypad button:active { transform: scale(0.94); background: var(--glass-bg-2); }
.keypad button.action { background: transparent; border: none; font-size: var(--fs-lg); }

/* OTP boxes */
.otp-row { display: flex; gap: var(--s-2); justify-content: center; }
.otp-box {
  width: 48px; height: 56px; text-align: center; font-size: var(--fs-2xl); font-weight: var(--fw-bold);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
}
.otp-box:focus { outline: none; border-color: var(--text); }

/* ---------- Empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-9) var(--s-6); text-align: center; color: var(--text-muted); }
.empty i { font-size: 34px; color: var(--text-faint); }

/* ---------- Progress / stepper ---------- */
.stepper { display: flex; gap: 6px; padding: 0 var(--s-5); }
.stepper .seg { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; }
.stepper .seg.done { background: var(--text); }
.stepper .seg.active::after { content:''; display:block; height:100%; width:50%; background: var(--text); border-radius: var(--r-pill); }

.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--plt-gold); border-radius: var(--r-pill); transition: width var(--t-slow) var(--ease-out); }
