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

:root {
--green-900: #1b4332;
--green-700: #2d6a4f;
--green-500: #40916c;
--green-200: #b7e4c7;
--green-100: #d8f3dc;
--green-50: #f0faf3;
--gray-900: #1a1a2e;
--gray-700: #3a3a4a;
--gray-500: #6b6b7b;
--gray-300: #c4c4cf;
--gray-100: #f4f4f6;
--white: #ffffff;
--red-500: #c1292e;
--amber-500: #f4a261;
--radius: 10px;
--radius-sm: 6px;
--shadow: 0 2px 12px rgba(0,0,0,0.06);
--shadow-lg: 0 6px 24px rgba(0,0,0,0.09);
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html { font-size: 17px; scroll-behavior: smooth; }
body {
font-family: var(--font-sans);
color: var(--gray-900);
background: var(--green-50);
line-height: 1.55;
min-height: 100vh;
display: flex;
flex-direction: column;
}

a { color: var(--green-700); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--green-900); }

.site-header {
background: var(--white);
border-bottom: 1px solid var(--green-200);
padding: 0.75rem 1.25rem;
position: sticky;
top: 0;
z-index: 10;
}
.header-inner {
max-width: 1200px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
text-decoration: none;
color: var(--gray-900);
font-weight: 650;
font-size: 1.1rem;
}
.logo-text { color: var(--green-900); }
.nav-list { display: flex; list-style: none; gap: 1.5rem; }
.nav-list a { text-decoration: none; font-weight: 500; color: var(--gray-700); }
.nav-list a:hover { color: var(--green-700); }

main { flex: 1; }

.hero {
padding: 2rem 1.25rem 1rem;
text-align: center;
max-width: 700px;
margin: 0 auto;
}
.hero h1 {
font-size: 2rem;
font-weight: 700;
color: var(--green-900);
margin-bottom: 0.5rem;
}
.hero-lead {
font-size: 1.1rem;
color: var(--gray-700);
max-width: 560px;
margin: 0 auto;
}

.app-shell {
padding: 0 1.25rem 2rem;
max-width: 1200px;
margin: 0 auto;
}
.app-grid {
display: grid;
grid-template-columns: 1fr 320px;
gap: 1.5rem;
align-items: start;
}

.worksheet-panel {
background: var(--white);
border-radius: var(--radius);
box-shadow: var(--shadow);
padding: 1.5rem;
}

.add-form { margin-bottom: 1.5rem; }
.form-title { font-size: 1rem; font-weight: 650; color: var(--gray-900); margin-bottom: 0.75rem; }
.form-row {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 120px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--gray-700); }
.field input, .field select {
padding: 0.55rem 0.7rem;
border: 1px solid var(--gray-300);
border-radius: var(--radius-sm);
font-size: 0.95rem;
font-family: inherit;
background: var(--white);
color: var(--gray-900);
}
.field input:focus, .field select:focus {
outline: 2px solid var(--green-500);
outline-offset: 1px;
border-color: var(--green-500);
}

.btn {
padding: 0.55rem 1.1rem;
border-radius: var(--radius-sm);
font-size: 0.9rem;
font-weight: 600;
font-family: inherit;
cursor: pointer;
border: 1px solid transparent;
transition: background 0.15s, box-shadow 0.15s;
white-space: nowrap;
}
.btn-primary { background: var(--green-700); color: var(--white); }
.btn-primary:hover { background: var(--green-900); }
.btn-secondary { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-outline { background: transparent; color: var(--green-700); border-color: var(--green-500); }
.btn-outline:hover { background: var(--green-100); }

.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 0.75rem;
margin-bottom: 1rem;
}
.list-heading { font-size: 1.05rem; font-weight: 650; }
.toolbar-actions { display: flex; gap: 0.5rem; }

.sub-list { min-height: 100px; }
.empty-state {
color: var(--gray-500);
text-align: center;
padding: 2rem 1rem;
font-style: italic;
}

.sub-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.7rem 0;
border-bottom: 1px solid var(--gray-100);
flex-wrap: wrap;
}
.sub-item:last-child { border-bottom: none; }
.sub-name { flex: 1; min-width: 120px; font-weight: 500; }
.sub-amount { min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gray-700); }
.sub-cycle { min-width: 60px; font-size: 0.8rem; color: var(--gray-500); text-transform: lowercase; }

.status-badge {
padding: 0.25rem 0.7rem;
border-radius: 20px;
font-size: 0.78rem;
font-weight: 600;
cursor: pointer;
border: none;
font-family: inherit;
min-width: 80px;
text-align: center;
transition: background 0.15s;
}
.status-active { background: var(--green-200); color: var(--green-900); }
.status-paused { background: #fff3cd; color: #856404; }
.status-canceled { background: #fce4e4; color: var(--red-500); }

.delete-btn {
background: transparent;
border: none;
color: var(--gray-500);
cursor: pointer;
font-size: 1.1rem;
padding: 0.25rem 0.5rem;
border-radius: var(--radius-sm);
}
.delete-btn:hover { color: var(--red-500); background: var(--gray-100); }

.action-bar {
display: flex;
align-items: center;
gap: 0.75rem;
margin-top: 1.5rem;
flex-wrap: wrap;
}
.share-msg { font-size: 0.85rem; color: var(--green-700); font-weight: 500; }

.summary-panel {
display: flex;
flex-direction: column;
gap: 1rem;
position: sticky;
top: 80px;
}
.summary-card {
background: var(--white);
border-radius: var(--radius);
box-shadow: var(--shadow);
padding: 1.2rem;
text-align: center;
}
.summary-card h3 { font-size: 0.85rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.3rem; }
.summary-number { font-size: 1.8rem; font-weight: 700; color: var(--green-900); font-variant-numeric: tabular-nums; }

.support-content {
padding: 2rem 1.25rem;
max-width: 900px;
margin: 0 auto;
}
.support-content h2 {
font-size: 1.5rem;
font-weight: 700;
color: var(--green-900);
margin-bottom: 1.25rem;
}
.support-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 1.25rem;
}
.support-block {
background: var(--white);
border-radius: var(--radius);
box-shadow: var(--shadow);
padding: 1.25rem;
}
.support-block h3 { font-size: 1rem; font-weight: 650; margin-bottom: 0.5rem; color: var(--gray-900); }
.support-block p { font-size: 0.9rem; color: var(--gray-700); line-height: 1.5; }

.assumptions {
padding: 1.5rem 1.25rem 2rem;
max-width: 700px;
margin: 0 auto;
text-align: center;
font-size: 0.9rem;
color: var(--gray-500);
}
.assumptions h2 { font-size: 1.1rem; color: var(--gray-700); margin-bottom: 0.75rem; }
.assumptions p { margin-bottom: 0.5rem; }
.version-line { font-size: 0.8rem; margin-top: 0.75rem; }

.site-footer {
background: var(--white);
border-top: 1px solid var(--green-200);
padding: 1rem 1.25rem;
text-align: center;
font-size: 0.85rem;
color: var(--gray-500);
margin-top: auto;
}
.site-footer a { color: var(--green-700); }

@media (max-width: 800px) {
.app-grid { grid-template-columns: 1fr; }
.summary-panel {
position: static;
flex-direction: row;
flex-wrap: wrap;
gap: 0.75rem;
}
.summary-card { flex: 1; min-width: 100px; }
.summary-number { font-size: 1.4rem; }
.hero h1 { font-size: 1.6rem; }
.form-row { flex-direction: column; }
.field { min-width: 100%; }
}

@media print {
.site-header, .site-footer, .add-form, .toolbar-actions, .action-bar, .summary-panel, .support-content, .assumptions, .hero { display: none; }
.app-shell { max-width: 100%; padding: 0; }
.app-grid { display: block; }
.worksheet-panel { box-shadow: none; border: none; padding: 0; }
.sub-item { break-inside: avoid; }
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
