:root {
  --ink: #1a1d29;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --brand: #2f6b4f;
  --brand-light: #e8f3ee;
  --revenue: #2f6b4f;
  --cogs: #b45309;
  --opex: #6b21a8;
  --profit: #1d4ed8;
  --danger: #b91c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--brand); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; gap: 10px; align-items: center; }
.sync-note { font-size: 12px; color: var(--muted); max-width: 320px; }
#auth-actions { display: flex; gap: 10px; align-items: center; }

select, button {
  font-family: inherit;
  font-size: 13px;
}

#business-select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-width: 180px;
}

.btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { background: #f0f1f3; }
.btn-secondary { border-color: var(--brand); color: var(--brand); }
.btn-ghost { border: none; background: transparent; color: var(--brand); }

main { padding: 22px 28px 60px; max-width: 1180px; margin: 0 auto; }

.banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.hidden { display: none !important; }
.link-btn { background: none; border: none; color: #9a3412; text-decoration: underline; cursor: pointer; font-weight: 600; }
.banner-info { background: var(--brand-light); border-color: #bcdfcd; color: #1f4d38; }
.banner-info a { color: var(--brand); font-weight: 600; }

.period-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.period-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.period-btn {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  font-family: inherit;
}
.period-btn.active { background: var(--ink); color: white; border-color: var(--ink); }
.custom-range { display: flex; align-items: center; gap: 8px; }
.custom-range input[type="date"] {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
}

.pl-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card-profit { background: var(--brand-light); border-color: #bcdfcd; }
.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card-delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.card-delta.up { color: var(--brand); }
.card-delta.down { color: var(--danger); }

.mid-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-header h2 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar-row-top { display: flex; justify-content: space-between; font-size: 12.5px; }
.bar-row-name { font-weight: 500; }
.bar-row-value { color: var(--muted); }
.bar-track { height: 7px; border-radius: 999px; background: #f0f1f3; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill.income { background: var(--revenue); }
.bar-fill.cogs { background: var(--cogs); }
.bar-fill.opex { background: var(--opex); }

.accounts-list { display: flex; flex-direction: column; gap: 10px; }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.account-row:last-child { border-bottom: none; }
.account-name { font-weight: 500; font-size: 13px; }
.account-meta { font-size: 11px; color: var(--muted); }
.account-balance { font-weight: 600; font-size: 13px; }
.account-balance.neg { color: var(--danger); }

.tabs { display: flex; gap: 6px; }
.tab {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.tab.active { background: var(--ink); color: white; border-color: var(--ink); }

.account-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.account-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.account-chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.account-chip.excluded:not(.active) { border-style: dashed; }
.account-chip .badge-excluded { font-size: 10px; }

.txn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.txn-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.txn-table th.num, .txn-table td.num { text-align: right; }
.txn-table td { padding: 9px 6px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.txn-table tr:hover { background: #fafafa; }

.amount-pos { color: var(--revenue); font-weight: 600; }
.amount-neg { color: var(--ink); }

.cat-select { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; background: white; }
.cat-select.uncategorized { border-color: #f59e0b; background: #fffbeb; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-transfer { background: #eef2ff; color: #4338ca; }
.badge-excluded { background: #fef2f2; color: #b91c1c; }

.account-row.excluded { opacity: 0.55; }
.account-row-right { display: flex; align-items: center; gap: 12px; }
.account-toggle { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; }
.account-toggle input { cursor: pointer; }

#payment-method-filter { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: white; font-size: 12.5px; color: var(--muted); font-family: inherit; }

.txn-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; }
.modal-card { background: white; border-radius: 12px; padding: 24px; max-width: 480px; width: 90%; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.modal-close { position: absolute; top: 10px; right: 14px; border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-sub { color: var(--muted); font-size: 13px; margin-top: -6px; margin-bottom: 16px; }
.modal-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.modal-card input, .modal-card textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; box-sizing: border-box; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.access-modal-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-light); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.access-modal-badge { display: inline-block; background: var(--brand-light); color: #1f4d38; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.access-modal-steps { background: var(--bg); border-radius: 8px; padding: 12px 14px; margin: 14px 0 16px; }
.access-modal-steps-label { margin: 0 0 10px; font-size: 11px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.03em; }
.access-modal-step { display: flex; gap: 10px; margin-bottom: 8px; }
.access-modal-step:last-child { margin-bottom: 0; }
.access-modal-step p { margin: 0; font-size: 13px; color: var(--ink); line-height: 1.4; }
.access-modal-step-num { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.access-modal-contact { font-size: 13px; color: var(--ink); margin-bottom: 4px; padding: 10px 12px; background: #fafafa; border-radius: 8px; border: 1px solid var(--line); }
.access-modal-note { font-size: 12.5px; margin: 10px 0 0; min-height: 16px; }
.access-modal-note.success { color: var(--brand); }
.access-modal-note.error { color: var(--danger); }
.optional-tag { font-weight: 400; color: var(--muted); }
.digest-subject { font-weight: 700; margin-bottom: 10px; }
.digest-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.digest-row:last-child { border: none; }

@media (max-width: 860px) {
  .pl-cards { grid-template-columns: repeat(2, 1fr); }
  .mid-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------- */
/* landing page                                                            */
/* ---------------------------------------------------------------------- */

.btn-primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn-primary:hover { background: #245a41; }
.btn-block { width: 100%; text-align: center; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.landing { max-width: 960px; margin: 0 auto; padding: 60px 28px 80px; }

.hero { text-align: center; margin-bottom: 70px; }
.hero h1 { font-size: 38px; line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.01em; }
.hero-sub { font-size: 16px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.hero-actions .btn { padding: 12px 22px; font-size: 14px; }
.hero-note { font-size: 12px; }

.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 70px;
}
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.feature h3 { margin: 0 0 8px; font-size: 15px; }
.feature p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.cta-band {
  text-align: center;
  background: var(--brand-light);
  border: 1px solid #bcdfcd;
  border-radius: var(--radius);
  padding: 40px 28px;
}
.cta-band h2 { margin: 0 0 8px; font-size: 22px; }
.cta-band p { margin: 0 0 20px; color: #1f4d38; }

.site-footer {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 50px;
  align-items: stretch;
}
.pricing-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}
.pricing-card.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.pricing-card h3 { margin: 0 0 4px; font-size: 16px; }
.pricing-price { font-size: 30px; font-weight: 700; margin: 10px 0 2px; }
.pricing-price span { font-size: 13px; font-weight: 400; color: var(--muted); }
.pricing-blurb { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 20px; flex: 1; }
.pricing-features li { font-size: 13px; padding: 5px 0; color: #333; }
.pricing-features li::before { content: "✓ "; color: var(--brand); font-weight: 700; }
.pricing-card .btn { width: 100%; text-align: center; }
.pricing-note { text-align: center; color: var(--muted); font-size: 12.5px; margin: -30px 0 50px; }

@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
}

/* ---------------------------------------------------------------------- */
/* auth pages (login / signup)                                             */
/* ---------------------------------------------------------------------- */

.auth-page { display: flex; justify-content: center; padding: 60px 20px; }
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 30px;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 6px; }
.auth-card label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 14px;
}
.auth-card input,
.auth-card select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: white;
}
/* ---------------------------------------------------------------------- */
/* csv upload page                                                         */
/* ---------------------------------------------------------------------- */

.upload-page { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.upload-account-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-account-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 200px; }
.new-account-fields { display: flex; gap: 10px; }
.new-account-fields input, .new-account-fields select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
#file-input { display: block; margin-top: 4px; }

.mapping-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.mapping-grid label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.mapping-grid select { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.mapping-mode { display: flex; gap: 20px; margin-bottom: 14px; font-size: 13px; }
.mapping-mode label { display: flex; align-items: center; gap: 6px; font-weight: normal; }

.password-hints {
  list-style: none;
  margin: -6px 0 14px;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}
.password-hints li { padding: 2px 0; padding-left: 18px; position: relative; }
.password-hints li::before { content: '○'; position: absolute; left: 0; }
.password-hints li.met { color: var(--brand); }
.password-hints li.met::before { content: '●'; }

.verify-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  gap: 12px;
}
.verify-banner button { flex-shrink: 0; }

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* ---------------------------------------------------------------------- */
/* reports.html — Income Statement / Cash Flow Statement                   */
/* ---------------------------------------------------------------------- */

.reports-main { padding: 22px 28px 60px; max-width: 720px; margin: 0 auto; }

.report-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.report-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.report-controls input[type="date"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; }

.statement h2 { margin: 0 0 4px; font-size: 17px; }
.statement-note { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }

.statement-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.statement-table td { padding: 6px 4px; }
.statement-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stmt-header td { font-weight: 600; padding-top: 16px; color: var(--ink); }
.stmt-header:first-child td { padding-top: 4px; }
.stmt-line td:first-child { padding-left: 16px; color: var(--muted); }
.stmt-subtotal td { border-top: 1px solid var(--line); font-weight: 600; padding-top: 8px; }
.stmt-total td { border-top: 2px solid var(--ink); font-weight: 700; padding-top: 8px; font-size: 14.5px; }

.report-links { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.report-link-card { display: block; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.report-link-card:hover { border-color: var(--accent, #444); transform: translateY(-1px); }
.report-link-card h3 { margin: 0 0 6px; font-size: 15px; }
.report-link-card p { margin: 0; }
@media (max-width: 560px) {
  .report-links { grid-template-columns: 1fr; }
}

@media print {
  .no-print { display: none !important; }
  body { background: white; }
  .reports-main { max-width: none; padding: 0; }
  .panel { border: none; padding: 0; margin-bottom: 24px; }
}
