:root {
    --brand-purple: #6739b7;
    --brand-accent: #5e35b1;
    --get-green: #2e7d32;
    --give-red: #d32f2f;
    --white: #ffffff;
    --safe-top: max(20px, env(safe-area-inset-top));
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: #f0f2f5; overflow-x: hidden; }
.app-container { max-width: 500px; margin: 0 auto; background: var(--white); min-height: 100vh; display: flex; flex-direction: column; position: relative; }
.hidden { display: none !important; }
.list-style-none { list-style: none; }

/* AUTH GATE */
.auth-header { background: linear-gradient(135deg, var(--brand-purple), var(--brand-accent)); padding: 80px 20px 60px; text-align: center; color: white; border-bottom-left-radius: 50px; border-bottom-right-radius: 50px; }
.logo-text { font-size: 28px; font-weight: 900; letter-spacing: 2px; display: block; }
.logo-subtext { font-size: 11px; opacity: 0.8; text-transform: uppercase; }
.auth-box { margin: -40px 30px 0; background: white; padding: 30px 20px; border-radius: 24px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 15px; z-index: 100; }
.auth-box h2 { color: var(--brand-purple); text-align: center; font-size: 20px; }
.onpage-error { color: #d32f2f; background: #ffebee; padding: 8px; border-radius: 8px; font-size: 12px; text-align: center; display: none; border: 1px solid #ffcdd2; }
.footer-note { text-align: center; font-size: 11px; color: #aaa; margin-top: auto; padding-bottom: 20px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 5px; }
.auth-links span { color: var(--brand-purple); font-size: 12px; cursor: pointer; font-weight: 700; }
.toggle-link { text-align: center; margin-top: 10px; color: var(--brand-purple); font-size: 12px; cursor: pointer; font-weight: 700; }

input, select { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid #ddd; background: #f9f9f9; font-size: 14px; outline: none; }
.primary-btn { background: var(--brand-purple); color: white; border: none; padding: 16px; border-radius: 12px; font-weight: 800; cursor: pointer; }

/* DASHBOARD FIXES */
.premium-header { background: linear-gradient(135deg, var(--brand-purple), var(--brand-accent)); padding: calc(var(--safe-top) + 20px) 20px 80px; color: white; text-align: center; border-bottom-left-radius: 35px; border-bottom-right-radius: 35px; position: relative; }
.header-top-actions { position: absolute; top: calc(var(--safe-top) + 10px); right: 20px; }
#profile-trigger { background: rgba(255,255,255,0.2); border: none; color: white; font-size: 20px; padding: 8px; border-radius: 50%; cursor: pointer; }
.balance-container { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 0 20px; margin-top: -40px; z-index: 5; }
.balance-card { background: white; padding: 20px 10px; border-radius: 20px; text-align: center; box-shadow: 0 8px 20px rgba(0,0,0,0.1); border-bottom: 5px solid transparent; }
.get-card { border-color: var(--get-green); }
.give-card { border-color: var(--give-red); }

.search-wrapper { padding: 20px; }
#search-input { border-radius: 30px; text-align: center; background: #f0f2f5; }
.input-section { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section-headline { padding: 10px 20px; font-weight: 800; color: var(--brand-purple); }
.summary-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #eee; cursor: pointer; }

/* NAV & PROFILE */
.detail-header { background: var(--brand-purple); padding: calc(var(--safe-top) + 15px) 20px 15px; color: white; display: flex; align-items: center; gap: 15px; }
.back-nav { background: rgba(255,255,255,0.2); border: none; color: white; padding: 8px 15px; border-radius: 12px; font-weight: 700; cursor: pointer; }
.settings-group { margin: 20px; }
.settings-group h3 { font-size: 13px; color: #888; margin-bottom: 10px; text-transform: uppercase; }
.settings-item { width: 100%; margin-bottom: 10px; padding: 18px; background: white; border: 1px solid #ddd; border-radius: 12px; text-align: left; font-weight: 700; cursor: pointer; }

.user-status-banner { margin: 20px; padding: 30px 20px; border-radius: 25px; text-align: center; color: white; font-weight: bold; }
.banner-get { background: linear-gradient(135deg, #66bb6a, #2e7d32); }
.banner-give { background: linear-gradient(135deg, #ef5350, #c62828); }
.action-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 0 20px; margin-bottom: 20px; }
.action-btn { padding: 14px; border-radius: 12px; border: none; font-weight: 800; color: white; }
.call-btn { background: #1a237e; }
.wa-btn { background: #25d366; }
.del-btn { background: #fff0f0; color: var(--give-red); border: 1px solid #ffcdd2; padding: 4px 8px; border-radius: 4px; font-size: 10px; margin-top: 5px; cursor: pointer; }