/* V3.17 - Charcoal + Electric Lime Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Match top bar color behind status bar (Dynamic Island / notch safe area) */
html {
    background: #0f172a;
}

/* M9: single source for the top safe-area inset (Dynamic Island / notch).
   A var rather than inline env() so devtools/tests can override it to
   simulate an island phone; env() resolves to 0 outside iOS standalone. */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: #1f2937;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: calc(1rem + var(--safe-area-top)) 0 1rem;
    box-shadow: 0 2px 10px rgba(30, 41, 59, 0.2);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

header nav a {
    color: white;
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

header nav a:hover {
    opacity: 0.8;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(30, 41, 59, 0.15);
}

.btn-primary {
    background: #84cc16;
    color: #1a2e05;
}

.btn-primary:hover {
    background: #65a30d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(132, 204, 22, 0.3);
}

.btn-secondary {
    background: #84cc16;
    color: #1a2e05;
}

.btn-secondary:hover {
    background: #65a30d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(132, 204, 22, 0.3);
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(30, 41, 59, 0.1);
    margin-bottom: 1.5rem;
    border: 2px solid #e2e8f0;
}

.card h2 {
    color: #1e293b;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #1e293b;
}

.form-group input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    vertical-align: middle;
    cursor: pointer;
}

.form-group label.radio-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    flex-shrink: 0;
    cursor: pointer;
}

.form-group label.radio-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #1e293b;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Dashboard */
.user-info {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.2);
    border: 3px solid #475569;
}

.user-info h2 {
    color: white;
    margin-bottom: 0.5rem;
}

.money-saved {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    color: #84cc16;
}

.money-details {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Challenge Type Buttons */
.challenge-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.challenge-type-card {
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.challenge-type-card:hover {
    border-color: #1e293b;
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(30, 41, 59, 0.2);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.challenge-type-card .emoji {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.challenge-type-card h3 {
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.challenge-type-card p {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Challenge Cards — iOS-native layout */
.challenge-card {
    background: white;
    border-radius: 16px;
    padding: 1.15rem 1.15rem 1rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 3px rgba(30, 41, 59, 0.05), 0 4px 14px rgba(30, 41, 59, 0.06);
    border: 1px solid #f1f5f9;
}

/* Header row: avatars | title+meta | badge */
.cc-header {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.cc-avatars {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    align-items: center;
    padding-top: 3px;
}

.cc-title-block {
    flex: 1;
    min-width: 0;
}

.cc-title {
    font-size: 17px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

.cc-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

.cc-badge {
    flex-shrink: 0;
    padding-top: 2px;
}

/* V4.94 card info block */
.cc-info-block {
    margin: 0.6rem 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
}

.cc-info-cols {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.cc-info-col { flex: 1; }
.cc-info-col-right { text-align: right; }

.cc-info-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.cc-info-value {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.cc-info-message {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
}

.cc-countdown.cc-expired { color: #dc2626 !important; }

/* Ref/challenger line */
.cc-ref-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.35rem 0;
}

.cc-ref-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cc-ref-text {
    font-size: 12px;
    color: #94a3b8;
}

/* Waiting text (no button, muted) */
.cc-waiting-text {
    font-size: 0.82rem;
    color: #94a3b8;
    text-align: center;
    padding: 0.4rem 0;
}

/* Full-width lime green primary button */
.cc-btn-primary {
    width: 100%;
    background: #84cc16;
    color: #1a2e05;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

/* "Details" accordion toggle */
.cc-details-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    padding: 0.4rem 0 0.15rem;
    cursor: pointer;
    margin-top: 0.2rem;
}
.cc-details-btn:hover { color: #64748b; }
.cc-details-btn.open { color: #64748b; }

/* Accordion panel */
.cc-accordion {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-top: 0;
}
.cc-accordion.open {
    max-height: 600px;
    padding-top: 0.5rem;
}

/* Secondary action buttons inside accordion */
.cc-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid #f1f5f9;
}

/* Standardized badge color palette */
.badge-status-active { background: #dbeafe; color: #1e40af; }
.badge-status-pending { background: #fef3c7; color: #92400e; }
.badge-status-completed { background: #d1fae5; color: #065f46; }
.badge-status-settled { background: #fee2e2; color: #991b1b; }
.badge-status-excusal { background: #fef3c7; color: #92400e; }
.badge-status-cancelled { background: #e2e8f0; color: #64748b; }
.badge-status-ref { background: #ecfccb; color: #3f6212; }

/* Divider */
.cc-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0.75rem 0;
}

/* Detail rows */
.cc-details {
    margin-bottom: 0.5rem;
}

.cc-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.2rem 0;
}

.cc-label {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.cc-value {
    font-size: 0.82rem;
    color: #374151;
    text-align: right;
    flex: 1;
}

/* Status message box (contextual prompt below details) */
.cc-status {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: #f8fafc;
    border-radius: 8px;
    line-height: 1.4;
}

/* Footer row: type pill | stake amount */
.cc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.65rem;
    border-top: 1px solid #f1f5f9;
}

.cc-stake {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1e293b;
}

/* Full-width action button(s) — stack on mobile */
.cc-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cc-actions .btn {
    /* M1: buttons keep their natural width and wrap as whole units instead of
       squeezing until their text breaks mid-word on narrow screens */
    flex: 1 1 auto;
    text-align: center;
    min-width: fit-content;
    white-space: nowrap;
}

/* History accent colors (left border on card) */
.challenge-card.completed-history {
    border-left: 3px solid #059669;
}

.challenge-card.donated {
    border-left: 3px solid #f59e0b;
}

.challenge-card.rejected-history {
    border-left: 3px solid #94a3b8;
}

.challenge-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #fff;
    margin: 2rem auto;
    margin-top: max(2rem, calc(var(--safe-area-top) + 0.5rem));
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 24px rgba(30, 41, 59, 0.2);
}

.modal-large {
    max-width: 700px;
}

.close {
    color: #9ca3af;
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: -0.5rem -0.5rem 0 0;
    -webkit-tap-highlight-color: transparent;
}

.close:hover {
    color: #1e293b;
}

/* Hero Metric (V4.2 banner — centered, spacious) */
.user-info {
    text-align: center;
    padding: 2rem 1.5rem;
}

.user-info h2 {
    color: white;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
    font-weight: 500;
    opacity: 0.9;
}

.hero-number {
    font-size: 3.5rem;
    font-weight: 800;
    color: #84cc16;
    line-height: 1.1;
}

.hero-label {
    font-size: 0.95rem;
    color: #94a3b8;
    font-weight: 600;
    margin-top: 0.25rem;
}

.hero-metric {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    color: #84cc16;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(49px + env(safe-area-inset-bottom));
    z-index: 900;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    /* M8 — promote to its own GPU layer so icons don't jiggle while page scrolls */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.15rem 0.75rem;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item.active {
    color: #84cc16;
}

.bottom-nav-item .nav-icon {
    font-size: 1.4rem;
    margin-bottom: 0.1rem;
    line-height: 1;
}

.bottom-nav-item .nav-label {
    font-weight: 600;
    font-size: 0.75rem; /* M7 — 12px clears Apple HIG 11pt minimum with margin */
}

/* The + create button in center of bottom nav */
.bottom-nav-item.create-btn {
    position: relative;
    padding: 0;
}

.bottom-nav-item.create-btn .nav-icon {
    background: #84cc16;
    color: #1a2e05;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    font-style: normal;
    margin-top: -18px;
    margin-bottom: 0;
    box-shadow: 0 4px 12px rgba(132, 204, 22, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bottom-nav-item.create-btn:active .nav-icon {
    transform: scale(0.92);
}

.bottom-nav-item.create-btn .nav-label {
    color: #84cc16;
    margin-top: 0.1rem;
}

/* Bottom Sheet */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.bottom-sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 1rem 1.5rem 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    z-index: 960;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet-content.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 4px;
    margin: 0 auto 1rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Stub Tabs */
.stub-tab {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.stub-tab .stub-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.stub-tab h2 {
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.stub-tab p {
    font-size: 1rem;
    max-width: 300px;
    margin: 0 auto 0.5rem;
}

/* History Tab Filters (V4.3) */
.history-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.history-filter {
    padding: 0.5rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.history-filter.active {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
}

.history-filter:hover:not(.active) {
    border-color: #94a3b8;
    color: #1e293b;
}

/* Proof Map (V4.3) */
#proof-map {
    z-index: 1;
}

/* History challenge card accents are handled in the Challenge Cards section above */

/* V4.5 — Success flash on approval (replaces confetti) */
.success-flash {
    animation: successFlash 1.5s ease-out;
}
@keyframes successFlash {
    0% { background-color: #d1fae5; }
    100% { background-color: transparent; }
}
.success-banner {
    background: #d1fae5;
    color: #065f46;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}


/* Version Badge — positioned top right */
.version-badge {
    position: fixed;
    top: calc(0.85rem + var(--safe-area-top));
    right: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    color: rgba(255, 255, 255, 0.6);
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    z-index: 899;
}

/* V4.4 — Stake Tier Selector */
.stake-tier-selector {
    display: flex;
    gap: 0.75rem;
}

.stake-tier {
    flex: 1;
    position: relative;
    padding: 0.9rem 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

/* Rec #8 — selected stake reads as money: green fill, white bold, pushed-in chips */
.stake-tier.selected {
    border-color: #059669;
    background: #059669;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.stake-tier.locked {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f8fafc;
}

.stake-tier.locked::after {
    content: '\1F512';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.9rem;
}

.stake-tier.unlocking {
    animation: unlockPop 0.8s ease-out;
    border-color: #84cc16;
}

.stake-tier.unlocking::after {
    content: '\1F513';
    animation: unlockSpin 0.8s ease-out;
}

@keyframes unlockPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.12); box-shadow: 0 0 20px rgba(132, 204, 22, 0.6); }
    100% { transform: scale(1); }
}

@keyframes unlockSpin {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-20deg) scale(1.3); }
    100% { transform: rotate(0deg); }
}

.stake-lock-msg {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.stake-progress {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: #64748b;
}

.stake-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 0.35rem;
    overflow: hidden;
}

.stake-progress-fill {
    height: 100%;
    background: #84cc16;
    border-radius: 3px;
    transition: width 0.6s ease-out;
}

/* V4.4 — Onboarding Modal */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f172a;
    z-index: 2000;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    opacity: 0;
    animation: fadeInOverlay 0.4s ease-out forwards;
}

@keyframes fadeInOverlay {
    to { opacity: 1; }
}

.onboarding-container {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    padding-top: max(2.5rem, calc(var(--safe-area-top) + 1rem));
    text-align: center;
    color: white;
    position: relative;
    margin: auto 0;
}

.onboarding-screen {
    display: none;
}

.onboarding-screen.active {
    display: block;
    animation: slideIn 0.35s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.onboarding-screen h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.onboarding-screen .subtext {
    font-size: 1.1rem;
    color: #94a3b8;
    line-height: 1.6;
}

.onboarding-screen h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1.5rem;
}

.onboarding-types {
    text-align: left;
    margin-bottom: 1.5rem;
}

.onboarding-types .type-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.onboarding-types .type-row:last-child {
    border-bottom: none;
}

.onboarding-types .type-emoji {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.onboarding-types .type-info strong {
    color: white;
    display: block;
    margin-bottom: 0.15rem;
}

.onboarding-types .type-info span {
    color: #94a3b8;
    font-size: 0.9rem;
}

.onboarding-paragraph {
    font-size: 1.05rem;
    color: #cbd5e1;
    line-height: 1.7;
    text-align: left;
}

.onboarding-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    text-align: left;
    cursor: pointer;
}

.onboarding-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: #84cc16;
    flex-shrink: 0;
}

.onboarding-checkbox span {
    color: #cbd5e1;
    font-size: 0.95rem;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0 1.5rem;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.4);
    transition: all 0.3s;
}

.onboarding-dot.active {
    background: #84cc16;
    width: 24px;
    border-radius: 4px;
}

.onboarding-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: #84cc16;
    color: #1a2e05;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.onboarding-btn:hover {
    background: #65a30d;
    transform: translateY(-1px);
}

.onboarding-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* V4.4 — Profile Tab */
.profile-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #84cc16;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 auto 1rem;
    text-transform: uppercase;
}

.avatar-plus-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    background: #84cc16;
    color: #1e293b;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
    z-index: 2;
}

.profile-username {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.profile-member-since {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.profile-stat {
    text-align: center;
    padding: 1rem 0.5rem;
    background: #f8fafc;
    border-radius: 12px;
}

.profile-stat .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

.profile-stat .stat-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.profile-stat.highlight .stat-value {
    color: #84cc16;
}

.profile-streak-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f1f5f9;
}

.profile-streak-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
}

.profile-streak-row .streak-label {
    color: #64748b;
    font-size: 0.9rem;
}

.profile-streak-row .streak-value {
    font-weight: 700;
    color: #1e293b;
    font-size: 1.1rem;
}

/* V4.5 — Proof Lightbox */
#proofLightbox .modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* V4.5 — History Proof Thumbnails */
.history-proof-thumb img {
    transition: transform 0.2s;
}

.history-proof-thumb img:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .challenge-types {
        grid-template-columns: 1fr;
    }

    .hero-metric {
        font-size: 2rem;
    }

    .hero-number {
        font-size: 3rem;
    }

}

/* ============================================================================
   FEATURE 1 — COMPLETION MODAL
   ============================================================================ */

.completion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--safe-area-top);
}

.completion-modal {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 500px;
    width: 90%;
}

.completion-headline {
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.completion-challenge-name {
    color: #84cc16;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.completion-copy {
    color: #94a3b8;
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

.completion-cta {
    font-size: 1.1rem;
    padding: 1rem 3rem;
    border-radius: 12px;
}

.completion-cta-secondary {
    font-size: 1rem;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    margin-top: 0.75rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    max-width: 320px;
}

.completion-cta-secondary:hover {
    border-color: rgba(255, 255, 255, 0.6);
    color: white;
}

/* ============================================================================
   FEATURE 3 — HISTORY BADGE
   ============================================================================ */

.history-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #1e293b;
    flex-shrink: 0;
}

/* ============================================================================
   AVATAR CROP MODAL
   ============================================================================ */

.crop-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--safe-area-top);
}

.crop-modal-content {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
}

.crop-modal-content h3 {
    color: #1e293b;
    margin-bottom: 1rem;
    text-align: center;
}

.crop-container {
    width: 100%;
    max-height: 50vh;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.crop-container img {
    display: block;
    max-width: 100%;
}

.crop-actions {
    display: flex;
    gap: 0.75rem;
}

.crop-actions .btn {
    flex: 1;
}

/* Circular crop preview for avatar */
.crop-container .cropper-view-box,
.crop-container .cropper-face {
    border-radius: 50%;
}

/* ============================================================================
   ONBOARDING FEATHER ICON
   ============================================================================ */

.onboarding-icon {
    margin-bottom: 1.5rem;
}

.onboarding-icon svg {
    width: 48px;
    height: 48px;
    stroke: #84cc16;
    stroke-width: 1.5;
}

/* Onboarding type row icon for screens using Feather instead of emoji */
.onboarding-types .type-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.onboarding-types .type-icon svg {
    width: 28px;
    height: 28px;
    stroke: #84cc16;
    stroke-width: 2;
}

/* ============================================================================
   INLINE VALIDATION INDICATORS
   ============================================================================ */

.field-status {
    font-size: 0.85rem;
    margin-top: 0.35rem;
    min-height: 1.2em;
    transition: color 0.2s;
}

.field-status.available {
    color: #059669;
}

.field-status.taken {
    color: #dc2626;
}

/* ============================================================================
   FEATHER ICONS IN NAV + CARDS
   ============================================================================ */

.bottom-nav-item .nav-icon svg {
    width: 22px;
    height: 22px;
}

.card-section-icon {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 0.35rem;
}

.card-section-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Pulse on the Your Move alert icon — draws eye to action items */
.your-move-icon svg {
    animation: your-move-pulse 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes your-move-pulse {
    0%, 100% {
        color: #1e293b;
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(132, 204, 22, 0));
    }
    50% {
        color: #84cc16;
        transform: scale(1.35);
        filter: drop-shadow(0 0 8px rgba(132, 204, 22, 0.8));
    }
}

/* Charity suggestion helper text */
.charity-suggestion-helper {
    color: #64748b;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Top bar for dashboard — centered wordmark */
.dashboard-top-bar {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding-top: calc(1rem + var(--safe-area-top));
    padding-bottom: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 800;
}

.dashboard-top-bar h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    margin: 0;
}

/* Invite button in top bar */
.top-bar-invite-btn {
    position: absolute;
    left: 1rem;
    top: calc(0.75rem + var(--safe-area-top));
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 8px;
    color: white;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.top-bar-invite-btn:active {
    background: rgba(255, 255, 255, 0.22);
}

.top-bar-invite-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

/* Spacer so content doesn't hide under fixed top bar */
.dashboard-top-bar-spacer {
    height: calc(60px + var(--safe-area-top));
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */
#toastContainer {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: center;
    pointer-events: none;
    width: calc(100% - 2rem);
    max-width: 420px;
}

.pello-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    pointer-events: all;
    animation: toastIn 0.25s ease;
    width: 100%;
    box-sizing: border-box;
}

.pello-toast-success {
    background: #064e3b;
    color: #d1fae5;
}

.pello-toast-error {
    background: #7f1d1d;
    color: #fee2e2;
}

.pello-toast-info {
    background: #1e293b;
    color: #e2e8f0;
}

.pello-toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.pello-toast-close:hover {
    opacity: 1;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Confirm Modal
   ============================================================================ */
#confirmModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.45);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    padding-top: max(1.5rem, calc(var(--safe-area-top) + 0.75rem));
}

#confirmModal.open {
    display: flex;
}

.confirm-modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.confirm-modal-msg {
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-modal-cancel {
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.confirm-modal-ok {
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: none;
    background: #1e293b;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

/* Tier 3.4 — hero streak indicator (informational, never threatening) */
.hero-streak {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #65a30d;
    letter-spacing: 0.01em;
}

/* ===== V5.1.0 burndown: loading spinner (U2) + avatar hint (M4) ===== */

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #1e293b;
    border-radius: 50%;
    margin: 2.5rem auto;
    animation: pello-spin 0.8s linear infinite;
}

@keyframes pello-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .loading-spinner { animation-duration: 2.4s; }
}

.avatar-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.4rem;
    text-align: center;
}

/* ============================================================================
   M10 — COMPACT CREATE FLOW (V5.1.4)
   (a) Type-chooser sheet: four compact rows, never needs a scroll.
   (b) Create forms: tighter rhythm + segmented radio groups so Card Details
       and Payment Method sit above the fold on a phone.
   ============================================================================ */

/* Type chooser: horizontal rows (icon left, text right) instead of tall cards */
.sheet-type-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0;
}

.sheet-type-list .challenge-type-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-align: left;
    padding: 0.75rem 1rem;
    border-width: 2px;
    border-radius: 14px;
}

.sheet-type-list .challenge-type-card:hover {
    transform: none;
    box-shadow: none;
}

.sheet-type-list .challenge-type-card .emoji {
    margin-bottom: 0;
    line-height: 0;
    flex-shrink: 0;
}

.sheet-type-list .challenge-type-card h3 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
}

.sheet-type-list .challenge-type-card p {
    font-size: 0.8rem;
}

/* Compact create modals */
.modal-content.compact-form {
    padding: 1.5rem;
}

.compact-form h2 {
    font-size: 1.2rem;
}

.compact-form .form-group {
    margin-bottom: 0.55rem;
}

.compact-form .form-group label {
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.compact-form .form-group label.radio-label {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.compact-form .form-group input,
.compact-form .form-group textarea,
.compact-form .form-group select {
    padding: 0.5rem 0.6rem;
}

.compact-form .stake-tier {
    padding: 0.55rem 0.4rem;
    font-size: 1rem;
    border-radius: 10px;
}

.compact-form .stake-tier-selector {
    gap: 0.5rem;
}

.compact-form .stake-lock-msg {
    min-height: 0;
    margin-top: 0.25rem;
}

.compact-form .stake-lock-msg:empty {
    display: none;
}

.compact-form .stake-progress {
    margin-bottom: 0.35rem;
}

/* applyStakeTiers leaves this empty once every tier is unlocked */
.compact-form .stake-progress:empty {
    display: none;
}

@media (max-width: 768px) {
    .modal-content.compact-form {
        width: 94%;
        padding: 1.1rem 1.1rem 0.9rem;
        margin: 0.75rem auto;
        margin-top: max(0.75rem, calc(var(--safe-area-top) + 4px));
        max-height: calc(100vh - max(1.25rem, var(--safe-area-top) + 8px));
        max-height: calc(100dvh - max(1.25rem, var(--safe-area-top) + 8px));
    }

    /* The sheet already sets the tone; on a phone the subtitle line is the
       difference between the payment section making the fold or not */
    .compact-form .modal-sub {
        display: none;
    }
}

/* Radio groups as single-row segmented controls */
.form-group.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form-group.segmented > label:first-child {
    flex: 0 0 100%;
    margin-bottom: 0.3rem;
}

.form-group.segmented .radio-label,
.compact-form .form-group.segmented .radio-label {
    position: relative;
    flex: 1 1 0;
    justify-content: center;
    margin: 0;
    padding: 0.45rem 0.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.form-group.segmented .radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.form-group.segmented .radio-label:has(input:checked) {
    border-color: #1e293b;
    background: #1e293b;
    color: #fff;
}

.form-group.segmented .radio-label:has(input:focus-visible) {
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.25);
}

/* Rec #8 — commitment sentence above every create submit button */
.commit-line {
    margin: 0.1rem 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #059669;
    text-align: center;
    line-height: 1.35;
}

.commit-line:empty {
    display: none;
}
