*{box-sizing:border-box;margin:0;padding:0}
:root{
  --blue:#2563eb;--blue-light:#dbeafe;--blue-dark:#1d4ed8;
  --green:#16a34a;--green-light:#dcfce7;
  --red:#dc2626;--red-light:#fee2e2;
  --gray-50:#f9fafb;--gray-100:#f3f4f6;--gray-200:#e5e7eb;--gray-300:#d1d5db;
  --gray-500:#6b7280;--gray-700:#374151;--gray-900:#111827;
  --radius:8px;--shadow:0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
  --shadow-md:0 4px 6px rgba(0,0,0,.07),0 2px 4px rgba(0,0,0,.06);
  --max-width:1120px;
}
html{scroll-behavior:smooth}
body{font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;color:var(--gray-900);background:var(--gray-50);line-height:1.6}
.container{max-width:var(--max-width);margin:0 auto;padding:0 1.25rem}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}
.hidden{display:none!important}

/* Header */
.site-header{background:#fff;border-bottom:1px solid var(--gray-200);position:sticky;top:0;z-index:100}
.site-header .container{display:flex;align-items:center;justify-content:space-between;height:56px}
.logo{display:flex;align-items:center;gap:.5rem;text-decoration:none;color:var(--gray-900);font-weight:700;font-size:1.1rem}
.logo svg{flex-shrink:0}
.site-nav{display:flex;gap:1.5rem}
.site-nav a{text-decoration:none;color:var(--gray-700);font-size:.9rem;font-weight:500}
.site-nav a:hover{color:var(--blue)}

/* Hero */
.hero{background:linear-gradient(135deg,#1e3a5f 0%,#2563eb 100%);color:#fff;padding:4rem 0 3.5rem}
.hero h1{font-size:2.2rem;font-weight:800;line-height:1.2;margin-bottom:.75rem}
.hero-sub{font-size:1.1rem;opacity:.9;max-width:560px;margin-bottom:1.5rem}
.hero-actions{display:flex;gap:.75rem;flex-wrap:wrap}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;padding:.6rem 1.25rem;border-radius:var(--radius);font-size:.9rem;font-weight:600;text-decoration:none;cursor:pointer;border:2px solid transparent;transition:all .15s}
.btn-primary{background:var(--blue);color:#fff;border-color:var(--blue)}
.btn-primary:hover{background:var(--blue-dark);border-color:var(--blue-dark)}
.btn-ghost{background:transparent;color:var(--blue);border-color:var(--blue)}
.btn-ghost:hover{background:var(--blue-light)}
.btn-danger{background:transparent;color:var(--red);border-color:var(--red)}
.btn-danger:hover{background:var(--red-light)}
.btn-sm{padding:.4rem .85rem;font-size:.82rem}
.btn-full{width:100%}

/* Cards */
.card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:1.5rem;margin-bottom:1.25rem}
.card h2{font-size:1.15rem;font-weight:700;margin-bottom:.25rem}
.card-hint{font-size:.85rem;color:var(--gray-500);margin-bottom:1rem}

/* Ledger layout */
.ledger-section{padding:2.5rem 0}
.ledger-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;align-items:start}
.ledger-right{position:sticky;top:72px}

/* Units */
.units-list{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem}
.unit-chip{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;background:var(--gray-100);border-radius:var(--radius);font-size:.9rem}
.unit-chip .remove-unit{background:none;border:none;color:var(--gray-500);cursor:pointer;font-size:1.1rem;line-height:1;padding:.1rem .3rem;border-radius:4px}
.unit-chip .remove-unit:hover{color:var(--red);background:var(--red-light)}
.inline-form{display:flex;gap:.5rem}
.inline-form input{flex:1}
.limit-msg{font-size:.82rem;color:var(--red);margin-top:.5rem}

/* Forms */
.entry-form{display:flex;flex-direction:column;gap:.75rem}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:.75rem}
.form-group{display:flex;flex-direction:column;gap:.25rem}
.form-group label{font-size:.82rem;font-weight:600;color:var(--gray-700)}
.form-group input,.form-group select{padding:.55rem .75rem;border:1px solid var(--gray-300);border-radius:var(--radius);font-size:.9rem;background:#fff;color:var(--gray-900)}
.form-group input:focus,.form-group select:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px rgba(37,99,235,.15)}

/* Summary */
.summary-controls{display:flex;gap:1rem;margin:1rem 0;flex-wrap:wrap;align-items:center}
.summary-controls label{font-size:.82rem;font-weight:600;color:var(--gray-700)}
.summary-controls select{padding:.4rem .6rem;border:1px solid var(--gray-300);border-radius:var(--radius);font-size:.85rem}
.summary-totals{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem}
.total-row{display:flex;justify-content:space-between;align-items:center;padding:.5rem 0;border-bottom:1px solid var(--gray-200);font-size:.95rem}
.total-row strong{font-size:1.05rem}
.total-row.net{border-bottom:none;border-top:2px solid var(--gray-900);margin-top:.25rem;padding-top:.75rem;font-weight:700}
.total-row.net strong{font-size:1.2rem}
.total-row .positive{color:var(--green)}
.total-row .negative{color:var(--red)}
.category-breakdown{margin-bottom:1rem}
.category-row{display:flex;justify-content:space-between;font-size:.82rem;padding:.3rem 0;border-bottom:1px solid var(--gray-100);color:var(--gray-700)}
.category-row:last-child{border-bottom:none}
.summary-actions{display:flex;gap:.5rem;flex-wrap:wrap}

/* Entries list */
.entries-list{max-height:300px;overflow-y:auto;display:flex;flex-direction:column;gap:.4rem}
.entry-row{display:grid;grid-template-columns:auto 1fr auto;gap:.5rem;align-items:center;padding:.5rem .6rem;border-radius:var(--radius);font-size:.82rem;background:var(--gray-50)}
.entry-row .entry-date{color:var(--gray-500);white-space:nowrap}
.entry-row .entry-info{overflow:hidden}
.entry-row .entry-info strong{display:block;font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry-row .entry-info span{color:var(--gray-500);font-size:.78rem}
.entry-row .entry-amount{font-weight:700;white-space:nowrap}
.entry-row .entry-amount.income{color:var(--green)}
.entry-row .entry-amount.expense{color:var(--red)}
.entry-row .remove-entry{background:none;border:none;color:var(--gray-300);cursor:pointer;font-size:1rem;padding:.1rem .2rem;border-radius:3px;margin-left:.25rem}
.entry-row .remove-entry:hover{color:var(--red)}
.empty-state{color:var(--gray-500);font-size:.9rem;text-align:center;padding:1.5rem .5rem}

/* Guide */
.guide-section{padding:3rem 0 4rem;background:#fff;border-top:1px solid var(--gray-200)}
.guide-section h2{font-size:1.6rem;font-weight:800;margin-bottom:1.5rem}
.guide-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:2.5rem}
.guide-block h3{font-size:1rem;font-weight:700;margin-bottom:.4rem;color:var(--blue-dark)}
.guide-block p{font-size:.92rem;color:var(--gray-700)}
.guide-examples{margin-bottom:2.5rem}
.guide-examples h3{font-size:1.1rem;font-weight:700;margin-bottom:.75rem}
.example-table{width:100%;border-collapse:collapse;font-size:.85rem}
.example-table th,.example-table td{padding:.5rem .6rem;text-align:left;border-bottom:1px solid var(--gray-200)}
.example-table th{background:var(--gray-100);font-weight:600;font-size:.8rem}
.guide-notes h3{font-size:1.1rem;font-weight:700;margin-bottom:.75rem;margin-top:1.5rem}
.guide-notes h3:first-child{margin-top:0}
.guide-notes ul{padding-left:1.25rem;margin-bottom:1rem}
.guide-notes li{font-size:.92rem;color:var(--gray-700);margin-bottom:.4rem}
.guide-notes p{font-size:.92rem;color:var(--gray-700)}

/* Footer */
.site-footer{background:var(--gray-900);color:var(--gray-300);padding:2rem 0;font-size:.82rem;text-align:center}
.site-footer a{color:var(--blue-light);text-decoration:none}
.site-footer a:hover{text-decoration:underline}
.site-footer p{margin-bottom:.4rem}

/* Responsive */
@media(max-width:860px){
  .ledger-grid{grid-template-columns:1fr}
  .ledger-right{position:static}
  .guide-grid{grid-template-columns:1fr}
  .form-row{grid-template-columns:1fr}
  .hero h1{font-size:1.7rem}
  .hero{padding:2.5rem 0 2rem}
  .summary-controls{flex-direction:column;align-items:flex-start}
}
@media(max-width:480px){
  .site-nav{gap:.75rem}
  .site-nav a{font-size:.82rem}
  .hero h1{font-size:1.4rem}
  .hero-sub{font-size:.95rem}
  .card{padding:1rem}
  .example-table{font-size:.75rem}
  .example-table th,.example-table td{padding:.35rem .4rem}
}

/* Print */
@media print{
  .site-header,.site-footer,.hero,.guide-section,.summary-actions,.entry-card,.units-card,.entry-row .remove-entry,.unit-chip .remove-unit{display:none!important}
  .ledger-grid{display:block}
  .ledger-right{position:static}
  .card{box-shadow:none;border:1px solid #ccc}
  body{background:#fff}
}



/* 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;
}
