/* ================== ROOT ================== */
#afd-mobile-root {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ================== CARDS ================== */
.afd-mobile-card {
    background: #020617;
    color: #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #1e293b;
    box-sizing: border-box;
}

/* ================== HEADER / AVATAR ================== */
.afd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.afd-header-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.afd-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    overflow: hidden;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #e5e7eb;
}

.afd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.afd-hello {
    font-size: 14px;
    font-weight: 600;
}

.afd-sub {
    font-size: 12px;
    color: #9ca3af;
}

/* ================== STATUS ROW / BADGES ================== */
.afd-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.afd-badge {
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.afd-badge-app {
    background: #4f46e5;
    color: #fff;
}

.afd-badge-browser {
    background: #1e293b;
    color: #9ca3af;
}

.afd-status-dot.online {
    color: #22c55e;
    font-size: 11px;
}

.afd-status-dot.offline {
    color: #f97373;
    font-size: 11px;
}

/* ================== BALANCE CARD ================== */
.afd-balance {
    position: sticky;
    top: 0;
    z-index: 5;
}

.afd-balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.afd-balance-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.afd-balance-value {
    font-size: 26px;
    font-weight: 700;
}

/* ================== SVG CHART ================== */
.afd-chart {
    margin: 12px 0 8px;
    height: 80px;
}

.afd-chart-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.afd-chart-line {
    fill: none;
    stroke: url(#afdChartLine);
    stroke-width: 1.8;
    stroke-linejoin: round;
    stroke-linecap: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: afd-chart-draw 0.9s ease-out forwards;
}

.afd-chart-fill {
    fill: url(#afdChartFill);
    opacity: 0;
    animation: afd-chart-fill 0.9s ease-out forwards 0.1s;
}

.afd-empty-chart {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    padding: 24px 0;
}

/* ================== TOGGLES & TABS ================== */
.afd-trend-toggle,
.afd-tabs {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.afd-trend-toggle button,
.afd-tabs button {
    flex: 1;
    border-radius: 999px;
    border: none;
    padding: 6px 10px;
    font-size: 12px;
    background: #111827;
    color: #9ca3af;
    cursor: pointer;
}

.afd-trend-toggle button.active,
.afd-tabs button.active {
    background: #4f46e5;
    color: #ffffff;
}

.sticky-tabs {
    margin-top: 10px;
}

/* ================== LIST ================== */
.afd-list-card {
    padding-top: 8px;
}

.afd-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #111827;
    min-height: 44px;
}

.afd-row:last-child {
    border-bottom: none;
}

.afd-row strong {
    font-size: 14px;
}

.afd-row small {
    font-size: 12px;
    color: #6b7280;
    letter-spacing: 0.2px;
}

.afd-amount {
    font-weight: 600;
    color: #22c55e;
}

.afd-empty {
    text-align: center;
    font-size: 13px;
    color: #64748b;
}

/* Load more */
.afd-load-more {
    margin-top: 12px;
    width: 100%;
    border-radius: 12px;
    border: none;
    padding: 10px;
    background: #1e293b;
    color: #e5e7eb;
    font-size: 13px;
    cursor: pointer;
}

/* ================== SKELETON (SHIMMER) ================== */
.afd-skeleton {
    height: 120px;
    border-radius: 16px;
    background: linear-gradient(
        90deg,
        #020617 0%,
        #111827 50%,
        #020617 100%
    );
    background-size: 200% 100%;
    animation: afd-shimmer 1.4s ease-in-out infinite;
}

/* ================== TOAST ================== */
#afd-toast {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    background: #0f172a;
    color: #e5e7eb;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 9999;
}

#afd-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ================== LOCK OVERLAY (optional, for biometric UX) ================== */
#afd-lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.9);
  display: none; /* show via JS when needed */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.afd-lock-inner {
  background: #020617;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 260px;
  border: 1px solid #1e293b;
}

.afd-lock-inner h3 {
  margin-bottom: 12px;
}

#afd-unlock-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: #4f46e5;
  color: #fff;
}

/* ================== ANIMATIONS ================== */
@keyframes afd-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes afd-chart-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes afd-chart-fill {
    to {
        opacity: 1;
    }
}

/* ================== DARK / LIGHT THEME ================== */
@media (prefers-color-scheme: light) {
    .afd-mobile-card {
        background: #ffffff;
        color: #0f172a;
        border-color: #e5e7eb;
    }
    .afd-row small {
        color: #6b7280;
    }
    .afd-empty,
    .afd-empty-chart {
        color: #9ca3af;
    }
    .afd-load-more {
        background: #f3f4f6;
        color: #111827;
        border-color: #e5e7eb;
    }
    #afd-toast {
        background: #111827;
        color: #f9fafb;
        border-color: #020617;
    }
}
/* iOS install button polish */
.afd-ios-install {
  background: linear-gradient(180deg, #0ea5e9, #0284c7);
  color: #fff;
  border-radius: 14px;
  font-weight: 600;
}

/* iOS install hint: make it look intentional */
#afd-ios-hint {
  position: relative;
  background: #0f172a;
  border: 1px dashed rgba(255,255,255,.25);
}

#afd-ios-hint::after {
  content: '⬆️';
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 24px;
  animation: afd-bounce 1.4s infinite;
}

@keyframes afd-bounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

