/**
 * Triplets Budget - Styles
 * A playful, modern design for kids learning about money
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --color-college: #3b82f6;
    --color-retirement: #8b5cf6;
    --color-everyday: #64748b;
    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #e2e8f0 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

button {
    cursor: pointer;
    font-family: inherit;
}

input, select {
    font-family: inherit;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.view {
    animation: fadeIn 0.3s ease-out;
}

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

/* ============================================
   Navigation
   ============================================ */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #475569, #334155);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #16a34a);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #dc2626);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: #f1f5f9;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: underline;
    padding: 0.5rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Allocation Info
   ============================================ */
.allocation-info {
    margin-bottom: 2rem;
    text-align: center;
}

.allocation-info h2 {
    margin-bottom: 1rem;
}

.allocation-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.allocation-item {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    min-width: 140px;
}

.allocation-item.college {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.allocation-item.retirement {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
}

.allocation-item.everyday {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.allocation-item .percentage {
    font-size: 1.75rem;
    font-weight: 800;
}

.allocation-item.college .percentage { color: var(--color-college); }
.allocation-item.retirement .percentage { color: var(--color-retirement); }
.allocation-item.everyday .percentage { color: var(--color-everyday); }

.allocation-item .label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   Account Cards Grid
   ============================================ */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.account-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 2px solid color-mix(in srgb, var(--card-color) 20%, transparent);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.account-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

.avatar.large {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.card-title h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.view-link {
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.view-link:hover {
    color: var(--text-primary);
}

.card-balance {
    padding: 1rem 1.25rem;
    border-top: 1px solid #f1f5f9;
}

.balance-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.balance-amount {
    font-size: 2rem;
    font-weight: 800;
}

/* Bucket Bar */
.bucket-bar {
    height: 12px;
    display: flex;
    background: #f1f5f9;
    overflow: hidden;
}

.bucket-bar .bucket {
    transition: width 0.5s ease;
}

.bucket-bar .bucket.college { background: var(--color-college); }
.bucket-bar .bucket.retirement { background: var(--color-retirement); }
.bucket-bar .bucket.everyday { background: var(--color-everyday); }

/* Bucket Breakdown */
.bucket-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    text-align: center;
}

.bucket-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.bucket-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.bucket-item .dot.college { background: var(--color-college); }
.bucket-item .dot.retirement { background: var(--color-retirement); }
.bucket-item .dot.everyday { background: var(--color-everyday); }

.bucket-item .amount {
    font-weight: 700;
    font-size: 0.95rem;
}

.bucket-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Card Footer */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.growth-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.growth-amount {
    font-weight: 700;
    color: var(--color-success);
}

/* Login Button */
.login-btn {
    margin: 0 1rem 1rem 1rem;
    width: calc(100% - 2rem);
    display: block;
    box-sizing: border-box;
}

/* ============================================
   Account Detail View
   ============================================ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--text-primary);
}

.account-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.account-header h1 {
    font-size: 2rem;
    font-weight: 800;
}

.account-header .subtitle {
    color: var(--text-secondary);
}

.account-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
}

.account-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.account-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Balance Cards */
.balance-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}


.balance-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e2e8f0;
}

.balance-card.total {
    border-width: 2px;
}

.balance-card.college { border-left: 4px solid var(--color-college); }
.balance-card.retirement { border-left: 4px solid var(--color-retirement); }
.balance-card.everyday { border-left: 4px solid var(--color-everyday); }

.balance-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.balance-card .amount {
    font-size: 1.25rem;
    font-weight: 700;
}

.balance-card.college .amount { color: var(--color-college); }
.balance-card.retirement .amount { color: var(--color-retirement); }
.balance-card.everyday .amount { color: var(--color-everyday); }

.balance-card .hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Chart */
.chart-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.view-toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: #e2e8f0;
}

.view-toggle-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.projection-view {
    margin-top: 1rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.range-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    background: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.range-btn:hover {
    background: #e2e8f0;
}

.range-btn.active {
    background: var(--text-primary);
    color: white;
}

/* Interest Rate Controls */
.rate-controls-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.rate-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rate-control label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.rate-input-wrapper {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.rate-input-wrapper:focus-within {
    border-color: var(--color-college);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.rate-input-wrapper input {
    width: 50px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    padding: 0.25rem;
}

.rate-input-wrapper input:focus {
    outline: none;
}

.rate-input-wrapper input::-webkit-outer-spin-button,
.rate-input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rate-input-wrapper input[type=number] {
    -moz-appearance: textfield;
}

.rate-suffix {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.rate-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rate-info {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-container {
    height: 320px;
    position: relative;
}

/* Monthly Contribution Section */
.contribution-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-lg);
}

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

.contribution-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #047857;
    margin: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #22c55e;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Contribution Controls */
.contribution-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #a7f3d0;
}

.contribution-amount {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.contribution-amount label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.amount-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #22c55e;
    border-radius: var(--radius-md);
    padding: 0.25rem 0.75rem;
}

.amount-input-wrapper .prefix {
    color: #22c55e;
    font-weight: 700;
    font-size: 1rem;
}

.amount-input-wrapper input {
    width: 80px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 700;
    color: #047857;
    padding: 0.25rem;
}

.amount-input-wrapper input:focus {
    outline: none;
}

.amount-input-wrapper input::-webkit-outer-spin-button,
.amount-input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Allocation Amounts */
.allocation-amounts {
    background: white;
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.allocation-inputs-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.allocation-amounts .form-group.compact {
    margin-bottom: 0;
}

.allocation-amounts .form-group.compact label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.allocation-amounts .form-group.compact label .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.allocation-amounts .form-group.compact label .dot.college { background: var(--color-college); }
.allocation-amounts .form-group.compact label .dot.retirement { background: var(--color-retirement); }
.allocation-amounts .form-group.compact label .dot.everyday { background: var(--color-everyday); }

.allocation-amounts .form-group.compact .label-text {
    white-space: nowrap;
}

.allocation-amounts .input-with-prefix {
    position: relative;
}

.allocation-amounts .input-with-prefix .prefix {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
}

.allocation-amounts .input-with-prefix input {
    width: 100%;
    padding: 0.375rem 0.5rem 0.375rem 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.allocation-amounts .input-with-prefix input:focus {
    outline: none;
    border-color: var(--color-college);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.allocation-total.compact {
    display: flex;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.allocation-total.compact .total-value {
    color: #22c55e;
}

@media (max-width: 600px) {
    .allocation-inputs-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* Allocation Sliders */
.allocation-sliders {
    background: white;
    border-radius: var(--radius-md);
    padding: 1rem;
}

.allocation-sliders h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.slider-group {
    margin-bottom: 0.75rem;
}

.slider-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.slider-label .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.slider-group.college .dot { background: var(--color-college); }
.slider-group.retirement .dot { background: var(--color-retirement); }
.slider-group.everyday .dot { background: var(--color-everyday); }

.slider-value {
    margin-left: auto;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
}

.slider-group.college .slider-value { color: var(--color-college); }
.slider-group.retirement .slider-value { color: var(--color-retirement); }
.slider-group.everyday .slider-value { color: var(--color-everyday); }

/* Range Slider Styling */
.allocation-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.allocation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.allocation-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-group.college .allocation-slider::-webkit-slider-thumb {
    background: var(--color-college);
}

.slider-group.retirement .allocation-slider::-webkit-slider-thumb {
    background: var(--color-retirement);
}

.slider-group.everyday .allocation-slider::-webkit-slider-thumb {
    background: var(--color-everyday);
}

/* Firefox */
.allocation-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.slider-group.college .allocation-slider::-moz-range-thumb {
    background: var(--color-college);
}

.slider-group.retirement .allocation-slider::-moz-range-thumb {
    background: var(--color-retirement);
}

.slider-group.everyday .allocation-slider::-moz-range-thumb {
    background: var(--color-everyday);
}

.allocation-total {
    display: flex;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.9rem;
}

.allocation-total .total-value {
    color: #22c55e;
}

.allocation-total .total-value.error {
    color: var(--color-danger);
}

/* Summary with contributions */
.summary-divider {
    width: 1px;
    height: 40px;
    background: #d1fae5;
    margin: 0 1rem;
}

.summary-item.contribution .label {
    color: #047857;
}

.summary-item.contribution .amount {
    color: #059669;
}

.summary-item.contribution.highlight {
    background: #d1fae5;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
}

.growth-summary {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #ecfdf5;
    border-radius: var(--radius-lg);
    border: 1px solid #a7f3d0;
}

.summary-item {
    text-align: center;
}

.summary-item .label {
    font-size: 0.85rem;
    color: #047857;
}

.summary-item .amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: #059669;
}

/* ============================================
   Transactions
   ============================================ */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.transaction {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.transaction.deposit {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.transaction.withdrawal {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.tx-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.transaction.deposit .tx-icon {
    background: #d1fae5;
    color: var(--color-success);
}

.transaction.withdrawal .tx-icon {
    background: #fee2e2;
    color: var(--color-danger);
}

.tx-details {
    flex: 1;
}

.tx-title {
    font-weight: 600;
}

.tx-bucket {
    font-weight: 400;
    color: var(--text-secondary);
}

.tx-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tx-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tx-amount {
    font-size: 1.1rem;
    font-weight: 700;
}

.tx-amount.deposit { color: var(--color-success); }
.tx-amount.withdrawal { color: var(--color-danger); }

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state .emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* ============================================
   Transaction Forms
   ============================================ */
.form-card {
    border-left: 4px solid;
}

.form-card.deposit {
    border-left-color: var(--color-success);
}

.form-card.withdraw {
    border-left-color: var(--color-danger);
}

.form-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-card .icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.form-card.deposit .icon {
    background: #d1fae5;
    color: var(--color-success);
}

.form-card.withdraw .icon {
    background: #fee2e2;
    color: var(--color-danger);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

.input-with-prefix {
    position: relative;
}

.input-with-prefix .prefix {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-prefix input {
    padding-left: 2rem;
}

/* Allocation Preview */
.allocation-preview {
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

.preview-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    text-align: center;
}

.preview-item {
    display: flex;
    flex-direction: column;
}

.preview-item span:first-child {
    font-weight: 700;
    font-size: 0.95rem;
}

.preview-item.college span:first-child { color: var(--color-college); }
.preview-item.retirement span:first-child { color: var(--color-retirement); }
.preview-item.everyday span:first-child { color: var(--color-everyday); }

.preview-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Warning */
.warning {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #92400e;
}

/* Locked & Login Prompt */
.locked, .login-prompt {
    text-align: center;
    padding: 2rem 1.5rem;
}

.locked .emoji, .login-prompt .emoji {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-prompt h3 {
    margin-bottom: 0.5rem;
}

.login-prompt p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    position: relative;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    background: #e2e8f0;
}

/* Login Form */
#login-form-container h2 {
    text-align: center;
    margin-bottom: 0.5rem;
}

#login-form-container .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.user-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid color-mix(in srgb, var(--user-color) 30%, transparent);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, color-mix(in srgb, var(--user-color) 8%, transparent), color-mix(in srgb, var(--user-color) 3%, transparent));
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.user-option:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.user-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.user-option .arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* Password Form */
.password-form {
    text-align: center;
}

.password-form .user-avatar {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    margin: 0 auto 1rem;
    border-radius: var(--radius-lg);
}

.password-form form {
    margin-top: 1.5rem;
    text-align: left;
}

.error-message {
    background: #fef2f2;
    color: var(--color-danger);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin: 2rem auto;
    font-size: 0.9rem;
    border: 1px solid #fecaca;
    text-align: center;
    max-width: 600px;
}

.accounts-grid .error-message {
    grid-column: 1 / -1;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    border-top: 1px solid #e2e8f0;
    margin-top: 3rem;
    background: white;
}

/* ============================================
   Responsive Design - Mobile & Tablet
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    /* Container & Spacing */
    .container {
        padding: 1.5rem 0.75rem;
    }
    
    /* Cards */
    .card {
        padding: 1rem;
    }
    
    .card h2 {
        font-size: 1.1rem;
    }
    
    /* Navigation */
    .logo {
        font-size: 1.1rem;
    }
    
    .logo-icon {
        font-size: 1.25rem;
    }
    
    /* Hero Section */
    .hero {
        margin-bottom: 1.5rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    /* Allocation Grid */
    .allocation-grid {
        gap: 0.75rem;
    }
    
    .allocation-item {
        padding: 0.75rem 1rem;
        min-width: 120px;
    }
    
    .allocation-item .percentage {
        font-size: 1.5rem;
    }
    
    /* Accounts Grid */
    .accounts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Account Header */
    .account-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .account-header h1 {
        font-size: 1.5rem;
    }
    
    .avatar.large {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }
    
    /* Account Layout */
    .account-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .account-main {
        gap: 1rem;
    }
    
    /* Balance Cards */
    .balance-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* Chart Controls */
    .chart-controls-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .rate-control {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Chart Container */
    .chart-container {
        height: 280px;
    }
    
    /* Contribution Section */
    .contribution-section {
        margin: 1rem 0;
        padding: 0.75rem;
    }
    
    .contribution-amount {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .amount-input-wrapper {
        width: 100%;
    }
    
    .amount-input-wrapper input {
        width: 100%;
    }
    
    /* Growth Summary */
    .growth-summary {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }
    
    .summary-item .amount {
        font-size: 1.25rem;
    }
    
    /* Transactions */
    .transaction {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    /* Buttons - Touch Friendly */
    .btn {
        min-height: 44px;
    }
    
    .range-btn {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 1rem 0.5rem;
    }
    
    /* Navigation */
    .navbar {
        padding: 0 0.75rem;
        height: 56px;
    }
    
    .logo {
        font-size: 1rem;
        gap: 0.5rem;
    }
    
    .logo-icon {
        font-size: 1.1rem;
    }
    
    /* Hero */
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    /* Cards */
    .card {
        padding: 0.75rem;
    }
    
    .card h2 {
        font-size: 1rem;
    }
    
    /* Allocation Items */
    .allocation-item {
        min-width: 100px;
        padding: 0.75rem;
    }
    
    .allocation-item .percentage {
        font-size: 1.25rem;
    }
    
    .allocation-item .label {
        font-size: 0.75rem;
    }
    
    /* Account Cards */
    .card-header {
        padding: 1rem;
    }
    
    .card-title h3 {
        font-size: 1.25rem;
    }
    
    .balance-amount {
        font-size: 1.75rem;
    }
    
    /* Account Header */
    .account-header h1 {
        font-size: 1.25rem;
    }
    
    .avatar.large {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    
    /* Balance Cards */
    .balance-cards {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    /* Chart */
    .chart-container {
        height: 240px;
    }
    
    .chart-controls {
        width: 100%;
    }
    
    .range-btn {
        flex: 1;
        font-size: 0.8rem;
    }
    
    /* Contribution */
    .contribution-section {
        padding: 0.5rem;
    }
    
    .contribution-header h3 {
        font-size: 0.9rem;
    }
    
    /* Growth Summary */
    .growth-summary {
        padding: 0.5rem;
        gap: 0.75rem;
    }
    
    .summary-item .label {
        font-size: 0.75rem;
    }
    
    .summary-item .amount {
        font-size: 1.1rem;
    }
    
    /* Modal */
    .modal-content {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    /* Footer */
    .footer {
        padding: 1.5rem 0.5rem;
        margin-top: 2rem;
    }
    
    /* Prevent overflow */
    body {
        overflow-x: hidden;
    }
    
    * {
        max-width: 100%;
    }
}

/* Growth Table */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
}

.table-nav-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-nav-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.table-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.table-page-info {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    max-width: 100%;
}

.growth-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.75rem;
    table-layout: fixed;
}

.growth-table thead {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.growth-table th {
    padding: 0.5rem 0.4rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #e2e8f0;
    min-width: 0;
}

.growth-table td {
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid #f1f5f9;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.growth-table tbody tr:hover {
    background: #f8fafc;
}

.growth-table tbody tr:last-child td {
    border-bottom: none;
}

.growth-table .row-label-header {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    width: 70px;
    min-width: 70px;
}

.growth-table .row-label {
    font-weight: 600;
    color: var(--text-secondary);
    background: #f8fafc;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid #e2e8f0;
    width: 70px;
    min-width: 70px;
    font-size: 0.7rem;
    white-space: nowrap;
}

.growth-table .row-label.college-col {
    color: var(--color-college);
}

.growth-table .row-label.retirement-col {
    color: var(--color-retirement);
}

.growth-table .row-label.everyday-col {
    color: var(--color-everyday);
}

.growth-table .row-label.total-col {
    color: var(--text-primary);
    font-weight: 700;
}

.growth-table .month-header {
    text-align: center;
    vertical-align: bottom;
    padding: 0.4rem 0.3rem;
    width: 80px;
    min-width: 80px;
}

.growth-table .month-header .month-num {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
}

.growth-table .month-header .month-age {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
}

.growth-table .college-col {
    color: var(--color-college);
    font-weight: 600;
    text-align: right;
    font-size: 0.7rem;
    white-space: nowrap;
}

.growth-table .retirement-col {
    color: var(--color-retirement);
    font-weight: 600;
    text-align: right;
    font-size: 0.7rem;
    white-space: nowrap;
}

.growth-table .everyday-col {
    color: var(--color-everyday);
    font-weight: 600;
    text-align: right;
    font-size: 0.7rem;
    white-space: nowrap;
}

.growth-table .total-col {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.75rem;
    text-align: right;
    white-space: nowrap;
}

