* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --bg-light: #f0f0ff;
    --bg-dark: #1a1a2e;
    --card-light: #ffffff;
    --card-dark: #252540;
    --text-light: #1f2937;
    --text-dark: #f3f4f6;
    --green: #10b981;
    --orange: #f59e0b;
    --red: #ef4444;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-light);
    color: var(--text-light);
    min-height: 100vh;
}

.app {
    min-height: 100vh;
    background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
}

.app.dark {
    --bg-light: #1a1a2e;
    --card-light: #252540;
    --text-light: #f3f4f6;
}

.header {
    padding: 1.5rem 1rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-main {
    flex: 1;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.app-tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.currency-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: 0.9rem;
}

.currency-dropdown {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
}

.currency-dropdown option {
    background: var(--primary-dark);
    color: white;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.main {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.hero-label {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-amount {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-light);
    margin: 0.5rem 0;
}

.hero-quote {
    color: #6b7280;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.milestone-section {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 1rem;
}

.milestone-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.milestone-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.milestone-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }
.stat-blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.stat-orange { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.stat-green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-light);
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
    text-align: center;
}

.quick-add-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.quick-add-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.quick-add-btn {
    background: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.quick-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.add-custom-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.add-custom-btn:hover {
    transform: translateY(-2px);
}

.habits-section {
    margin-bottom: 1.5rem;
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.habit-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.habit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.habit-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.habit-emoji {
    font-size: 1.5rem;
}

.habit-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.habit-actions {
    display: flex;
    gap: 0.5rem;
}

.habit-actions button {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.habit-actions button:hover {
    opacity: 1;
}

.habit-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.habit-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
}

.habit-value {
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 0.9rem;
}

.savings-display {
    text-align: center;
    margin-bottom: 1rem;
}

.savings-label {
    display: block;
    color: var(--green);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.savings-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--green);
}

.time-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.time-unit {
    text-align: center;
}

.time-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.time-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.time-divider {
    width: 1px;
    background: #e5e7eb;
}

.reset-btn {
    display: block;
    margin: 1rem auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.investment-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.investment-section .section-title {
    color: var(--text-light);
}

.section-subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.investment-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.investment-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
}

.input-hint {
    font-size: 0.75rem;
    color: #9ca3af;
}

.wasted-card {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.wasted-label {
    display: block;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.25rem;
}

.wasted-amount {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: #ea580c;
}

.wasted-subtitle {
    font-size: 0.85rem;
    color: #92400e;
}

.investment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.investment-card {
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    color: white;
}

.inv-emoji {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.inv-name {
    display: block;
    font-size: 0.8rem;
    opacity: 0.9;
}

.inv-amount {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.future-section {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.future-section h2 {
    color: #065f46;
    margin-bottom: 0.5rem;
}

.future-section p {
    color: #047857;
    line-height: 1.6;
}

.future-tagline {
    font-weight: 600;
    margin-top: 1rem !important;
}

.footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.8);
}

.footer a {
    color: white;
    font-weight: 600;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
}

.modal h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
}

.emoji-input {
    max-width: 80px;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-cancel {
    flex: 1;
    padding: 0.75rem;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
}

.modal-add {
    flex: 1;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.confetti-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    border-radius: 2px;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.app.dark .hero-card,
.app.dark .stat-card,
.app.dark .habit-card,
.app.dark .investment-section,
.app.dark .modal {
    background: var(--card-dark);
    color: var(--text-dark);
}

.app.dark .quick-add-btn {
    background: var(--card-dark);
    color: var(--text-dark);
}

.app.dark .habit-input,
.app.dark .investment-input,
.app.dark .modal-input {
    background: #1a1a2e;
    border-color: #3f3f5a;
    color: var(--text-dark);
}

.app.dark .habit-value {
    background: #1a1a2e;
}

.app.dark .milestone-section {
    background: #1a1a2e;
}

.app.dark .time-divider,
.app.dark .habit-inputs + .savings-display {
    border-color: #3f3f5a;
}