/* --------------------------------------------------
   AnchorPay – Dashboard
   Visual language matches Friends / Home (index.1386.css+)
-----------------------------------------------------*/

:root {
  --ap-bg: #f3f4f6;
  --ap-surface: #ffffff;
  --ap-ink: #0b1021;
  --ap-muted: #6b7280;
  --ap-primary: #1f3a8a;
  --ap-primary-soft: #e0ebff;
  --ap-teal: #14b8a6;
  --ap-danger: #ef4444;
  --ap-border: #e5e7eb;
  --ap-radius-lg: 18px;
  --ap-radius-pill: 999px;
  --ap-shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.18);
  --ap-shadow-subtle: 0 10px 28px rgba(15, 23, 42, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", sans-serif;
  background: var(--ap-bg);
  color: var(--ap-ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* Visually hidden for accessible labels */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------
   Top bar (alias for Friends/Home styles)
-----------------------------------------------------*/

.topbar,
.ap-top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(243, 244, 246, 0.98);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.logo,
.ap-logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.02rem;
}

.logo span,
.ap-logo span {
  color: var(--ap-primary);
}

/* Centered title for dashboard top bar */
.ap-top-bar__inner {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ap-top-bar__center {
  flex: 1;
  text-align: center;
}

.ap-top-bar__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* --------------------------------------------------
   Layout
-----------------------------------------------------*/

.ap-main {
  min-height: calc(100vh - 56px);
  padding: 12px 16px 72px;
}

.ap-main--with-bottom-nav {
  padding-bottom: 80px;
}

.dash-layout {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --------------------------------------------------
   Error banner
-----------------------------------------------------*/

.dash-error-banner {
  position: sticky;
  top: 52px;
  z-index: 25;
  padding: 6px 16px 0;
}

.dash-error-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fef2f2;
  border-radius: 16px;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  box-shadow: 0 16px 32px rgba(185, 28, 28, 0.12);
}

.dash-error-banner__title {
  margin: 0 0 2px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #991b1b;
}

.dash-error-banner__message {
  margin: 0;
  font-size: 0.8rem;
  color: #7f1d1d;
}

.dash-error-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dash-error-banner__button {
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--ap-radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
}

.dash-error-banner__button--primary {
  background: #b91c1c;
  color: #fef2f2;
  border-color: transparent;
}

.dash-error-banner__button--ghost {
  background: transparent;
  color: #7f1d1d;
  border-color: rgba(248, 113, 113, 0.6);
}

.dash-error-banner__button:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 2px;
}

/* --------------------------------------------------
   Cards
-----------------------------------------------------*/

.dash-card {
  background: radial-gradient(circle at top left, #ffffff, #f9fafb);
  border-radius: var(--ap-radius-lg);
  box-shadow: var(--ap-shadow-subtle);
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 12px 14px 14px;
}

.dash-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dash-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.dash-body {
  font-size: 0.86rem;
  color: var(--ap-muted);
}

/* Balance card tweaks */

.dash-card--balance {
  padding: 14px 16px 16px;
}

.dash-balance-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.dash-label {
  font-size: 0.82rem;
  color: var(--ap-muted);
}

.dash-value {
  font-size: 0.92rem;
  font-weight: 600;
}

.dash-value--xl {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Summary metrics under balance */

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.dash-metric {
  padding: 8px 9px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.dash-metric .dash-label {
  display: block;
  margin-bottom: 3px;
}

.dash-metric .dash-value {
  font-size: 0.9rem;
}

/* Summary / safety cards */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 12px;
}

.dash-card--summary .dash-body,
.dash-card--safety .dash-body {
  margin: 0;
  line-height: 1.4;
}

/* --------------------------------------------------
   Deadlines list
-----------------------------------------------------*/

.dash-deadlines-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-deadline-row {
  padding: 7px 9px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.dash-deadline-title {
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.dash-deadline-meta {
  font-size: 0.8rem;
  color: var(--ap-muted);
}

.dash-empty {
  font-size: 0.84rem;
  color: var(--ap-muted);
}

/* --------------------------------------------------
   Recent activity
-----------------------------------------------------*/

.dash-activity-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition:
    box-shadow 120ms ease,
    transform 80ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.dash-activity-row:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.dash-activity-row:active {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  transform: translateY(0);
}

.dash-activity-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.dash-activity-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.dash-activity-meta {
  font-size: 0.78rem;
  color: var(--ap-muted);
}

.dash-activity-right {
  flex-shrink: 0;
}

.dash-activity-amount {
  font-size: 0.88rem;
  font-weight: 600;
}

/* --------------------------------------------------
   Withdrawals
   (Current withdrawals list – mirrors activity style)
-----------------------------------------------------*/

.dash-withdrawals-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Outer row container (handles background, border, slide + hide) */
.dash-withdrawal-row {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  transition:
    box-shadow 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease;
}

/* Inner flex content that slides left/right */
.dash-withdrawal-row-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  cursor: pointer;
  transition: transform 160ms ease;
}

.dash-withdrawal-row:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.dash-withdrawal-row:active {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

/* When JS adds this class, slide content left to reveal Hide button */
.dash-withdrawal-row--actions-visible .dash-withdrawal-row-inner {
  transform: translateX(-72px);
}

/* Hide button on the right – starts invisible; fades in when row is “open” */
.dash-withdrawal-hide-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  padding: 0.3rem 0.8rem;
  border-radius: var(--ap-radius-pill);
  border: none;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  opacity: 0;
  pointer-events: none;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    transform 80ms ease,
    opacity 120ms ease;
}

.dash-withdrawal-row--actions-visible .dash-withdrawal-hide-btn {
  opacity: 1;
  pointer-events: auto;
}

.dash-withdrawal-hide-btn:hover {
  background: #dbeafe;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.32);
}

.dash-withdrawal-hide-btn:active {
  transform: translateY(-50%) scale(0.97);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.25);
}

.dash-withdrawal-hide-btn:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* Content blocks inside each withdrawal row */

.dash-withdrawal-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.dash-withdrawal-title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-withdrawal-meta {
  font-size: 0.78rem;
  color: var(--ap-muted);
}

.dash-withdrawal-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.dash-withdrawal-amount {
  font-size: 0.88rem;
  font-weight: 600;
}

/* status chip */

.dash-withdrawal-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--ap-radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
}

/* Pending (requested) */
.dash-withdrawal-status--pending {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

/* Approved */
.dash-withdrawal-status--approved {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

/* Rejected */
.dash-withdrawal-status--rejected {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

/* Completed (paid) */
.dash-withdrawal-status--completed {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #4c1d95;
}

/* Unknown / fallback */
.dash-withdrawal-status--unknown {
  border-color: #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
}

/* Footer row under withdrawals list with “see all” link */

.dash-withdrawals-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

/* Support both the class and the JS id */
.dash-withdrawals-more-btn,
.dash-withdrawals-see-all,
#dashWithdrawalsMoreBtn,
#dashWithdrawalsSeeAll {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* subtle arrow to match iOS style */
.dash-withdrawals-more-btn::after,
.dash-withdrawals-see-all::after,
#dashWithdrawalsMoreBtn::after,
#dashWithdrawalsSeeAll::after {
  content: "›";
  font-size: 0.9em;
  margin-top: 1px;
}

.dash-withdrawals-more-btn:hover,
.dash-withdrawals-see-all:hover,
#dashWithdrawalsMoreBtn:hover,
#dashWithdrawalsSeeAll:hover {
  text-decoration: underline;
}

.dash-withdrawals-more-btn:active,
.dash-withdrawals-see-all:active,
#dashWithdrawalsMoreBtn:active,
#dashWithdrawalsSeeAll:active {
  transform: translateY(1px);
}

.dash-withdrawals-more-btn:focus-visible,
.dash-withdrawals-see-all:focus-visible,
#dashWithdrawalsMoreBtn:focus-visible,
#dashWithdrawalsSeeAll:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* --------------------------------------------------
   Tasks / next steps
-----------------------------------------------------*/

.dash-tasks-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.dash-task-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.dash-task-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.dash-task-meta {
  font-size: 0.8rem;
  color: var(--ap-muted);
}

.dash-task-cta {
  padding: 0.35rem 0.95rem;
  border-radius: var(--ap-radius-pill);
  border: none;
  background-image: linear-gradient(90deg, var(--ap-primary), #2563eb);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(31, 58, 138, 0.25);
  transition:
    background 150ms ease,
    box-shadow 150ms ease,
    transform 80ms ease,
    opacity 80ms ease;
}

.dash-task-cta:hover {
  background-image: linear-gradient(90deg, #1d4ed8, var(--ap-primary));
  box-shadow: 0 10px 22px rgba(31, 58, 138, 0.32);
  transform: translateY(-1px);
}

.dash-task-cta:active {
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.3);
  transform: translateY(0);
}

.dash-task-cta:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* --------------------------------------------------
   Bottom navigation (alias for Friends/Home)
-----------------------------------------------------*/

.bottom-nav,
.ap-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  padding: 8px 10px 10px;
  background: rgba(243, 244, 246, 0.98);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(229, 231, 235, 0.9);
}

.bottom-nav a,
.ap-bottom-nav__item {
  flex: 1;
  margin: 0 4px;
  text-align: center;
  padding: 7px 4px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--ap-muted);
  font-weight: 500;
}

.bottom-nav a.active,
.ap-bottom-nav__item--active {
  background: #111827;
  color: #f9fafb;
}

/* --------------------------------------------------
   Small screens tweaks
-----------------------------------------------------*/

@media (max-width: 380px) {
  .topbar,
  .ap-top-bar {
    padding-inline: 12px;
  }

  .ap-main {
    padding-inline: 12px;
  }

  .dash-card {
    padding-inline: 12px;
  }
}
