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

:root {
  --blue:     #2b6cb0;
  --blue-dk:  #1a4e8a;
  --green:    #276749;
  --red:      #e53e3e;
  --orange:   #ed8936;
  --bg:       #f5f7fa;
  --border:   #e2e8f0;
  --text:     #1a202c;
  --muted:    #718096;
  --radius:   10px;
  --shadow:   0 2px 12px rgba(0,0,0,.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

.site-header { background: var(--blue-dk); padding: .875rem 0; position: sticky; top: 0; z-index: 100; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.25rem; font-weight: 800; color: #fff; }
.logo span { color: #90cdf4; }
nav a { color: rgba(255,255,255,.85); text-decoration: none; margin-left: 1.5rem; font-size: .9rem; }
nav a:hover { color: #fff; }

.hero { background: linear-gradient(135deg, var(--blue-dk), #2b6cb0); color: #fff; padding: 3rem 0 2.5rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: .75rem; }
.hero-sub { font-size: 1.05rem; opacity: .88; max-width: 540px; margin: 0 auto; }

.calc-layout { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; margin: 2rem 0; align-items: start; }
@media (max-width: 820px) { .calc-layout { grid-template-columns: 1fr; } }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.card-header h2 { font-size: 1.05rem; font-weight: 700; color: var(--blue-dk); }
.total-badge { font-size: .85rem; font-weight: 700; padding: .2rem .65rem; border-radius: 20px; }
.income-badge  { background: #c6f6d5; color: #276749; }
.expense-badge { background: #fed7d7; color: #c53030; }

.expense-section { margin-bottom: 1rem; }
.expense-section-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }

.field-group { margin-bottom: .75rem; }
.field-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.field-group input { width: 100%; padding: .5rem .75rem; border: 1.5px solid var(--border); border-radius: 6px; font-size: .95rem; color: var(--text); transition: border-color .15s; }
.field-group input:focus { outline: none; border-color: var(--blue); }
.hint { font-size: .75rem; color: var(--muted); margin-top: .2rem; display: block; }
.hint a { color: var(--blue); }

/* Results */
.results-col { position: sticky; top: 5rem; }
.summary-card h2 { font-size: 1.05rem; font-weight: 700; color: var(--blue-dk); margin-bottom: 1.25rem; }
.balance-display { text-align: center; padding: 1rem 0 .75rem; }
.balance-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.balance-amount { font-size: 2.2rem; font-weight: 800; margin: .25rem 0; }
.balance-amount.surplus { color: var(--green); }
.balance-amount.deficit { color: var(--red); }
.balance-sub { font-size: .8rem; color: var(--muted); }

.budget-bar-wrap { margin: .75rem 0 1rem; }
.budget-bar { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width .3s, background .3s; }
.bar-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: .3rem; }

.breakdown { border-top: 1px solid var(--border); padding-top: .75rem; margin-bottom: 1rem; }
.breakdown-row { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .9rem; border-bottom: 1px dashed var(--border); }
.breakdown-row:last-child { border-bottom: none; font-weight: 700; }
.income-row span:last-child { color: var(--green); font-weight: 600; }
.expense-row span:last-child { color: var(--red); font-weight: 600; }

.category-breakdown h3 { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .6rem; }
.cat-row { margin-bottom: .5rem; }
.cat-info { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .2rem; }
.cat-label { color: var(--text); }
.cat-amount { font-weight: 600; }
.cat-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: .15rem; }
.cat-bar { height: 100%; border-radius: 3px; transition: width .3s; }
.cat-bar-needs   { background: var(--blue); }
.cat-bar-wants   { background: var(--orange); }
.cat-bar-savings { background: #48bb78; }
.cat-pct { font-size: .72rem; color: var(--muted); }

/* 50/30/20 */
.rule-card { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-top: 1rem; }
.rule-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .75rem; }
.rule-item { margin-bottom: .75rem; }
.rule-label { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.rule-bar-wrap { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: .2rem; }
.rule-bar { height: 100%; border-radius: 4px; transition: width .3s, background .3s; }
.rule-vals { display: flex; justify-content: space-between; font-size: .75rem; }
.rule-target { color: var(--muted); }

/* Tips */
.content-section { margin: 3rem 0; }
.content-section h2 { font-size: 1.4rem; font-weight: 800; color: var(--blue-dk); margin-bottom: 1.25rem; }
.tips-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.tip-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.tip-icon { font-size: 1.5rem; margin-bottom: .5rem; }
.tip-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; }
.tip-card p { font-size: .875rem; color: var(--muted); }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: .75rem; }
details { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
summary { font-weight: 600; cursor: pointer; font-size: .95rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: '+ '; color: var(--blue); font-weight: 800; }
details[open] summary::before { content: '− '; }
details p { margin-top: .6rem; font-size: .875rem; color: var(--muted); line-height: 1.7; }
details a { color: var(--blue); }

.site-footer { background: var(--blue-dk); color: rgba(255,255,255,.7); padding: 1.5rem 0; margin-top: 3rem; text-align: center; font-size: .82rem; }
.site-footer a { color: #90cdf4; text-decoration: none; }
.site-footer p + p { margin-top: .4rem; }
