:root {
  color-scheme: light;
  --ink: #17251f;
  --muted: #6a7b72;
  --line: #e2e9e4;
  --surface: #fff;
  --canvas: #f3f7f4;
  --green: #157347;
  --green-dark: #0e5a36;
  --red: #b5473c;
  --amber: #9c6514;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: inherit; text-decoration: none; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 18px max(24px, calc((100% - 1440px) / 2)); background: #102b20; color: white; }
.brand { font-size: 19px; font-weight: 800; letter-spacing: -.03em; }
.brand span { margin-left: 8px; color: #b9d8c6; font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.topbar nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.topbar nav > a:not(.button) { color: #e0eee5; }
.business-switcher-shell { display: flex; width: min(1440px, calc(100% - 40px)); align-items: center; gap: 22px; margin: 20px auto 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 3px 12px #183a2508; }
.business-switcher-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.business-switcher { display: flex; flex: 1; gap: 10px; }
.business-option { position: relative; display: flex; min-width: 210px; align-items: center; gap: 11px; padding: 9px 13px; border: 1px solid transparent; border-radius: 11px; color: var(--ink); transition: border-color .15s, background .15s, transform .15s; }
.business-option:hover { transform: translateY(-1px); border-color: #e0e9e3; background: #f8fbf9; }
.business-option.is-active { border-color: #cfe3d6; background: linear-gradient(110deg, #edf6f0, #f8fbf9); box-shadow: inset 3px 0 #258153; }
.business-mark { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; font-size: 15px; font-weight: 850; }
.business-mark-as13 { background: #e5f1e9; color: #17653e; }
.business-mark-chicha { background: #f4eafa; color: #70418d; }
.business-option-copy { display: grid; gap: 2px; }
.business-option-copy strong { font-size: 13px; letter-spacing: -.01em; }
.business-option-copy small { color: var(--muted); font-size: 10px; }
.business-active-indicator { margin-left: auto; padding: 4px 7px; border-radius: 999px; background: #dcefe3; color: #17653e; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.logout-form { margin: 0; }
.logout-button { padding: 6px 9px; border: 1px solid #ffffff36; border-radius: 7px; background: transparent; color: #e0eee5; font: inherit; font-size: 11px; cursor: pointer; }
.logout-button:hover { border-color: #ffffff80; background: #ffffff12; }
.container { width: min(1440px, calc(100% - 40px)); margin: 34px auto 60px; }
.page-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.page-heading { margin-bottom: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 7px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.page-heading .muted { margin: 0; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 9px 15px; border: 0; border-radius: 8px; background: var(--green); color: white; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.button:hover { background: var(--green-dark); }
.button-small { min-height: 33px; padding: 7px 11px; font-size: 12px; }
.button-quiet { border: 1px solid var(--line); background: white; color: var(--ink); }
.button-quiet:hover { background: #edf4ef; }
.button-danger { background: #fff2f0; color: var(--red); }
.button-danger:hover { background: #fce4e0; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav form { margin: 0; }
.month-nav input { min-width: 150px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card, .panel, .month-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 6px #183a2510; }
.summary-card { display: flex; min-height: 108px; flex-direction: column; justify-content: center; gap: 8px; padding: 18px 20px; }
.summary-card span { color: var(--muted); font-size: 13px; }
.summary-card strong { font-size: 23px; letter-spacing: -.03em; }
.expense-card { border-top: 3px solid #d27d65; }
.income-card { border-top: 3px solid #4f9b72; }
.misc-card { border-top: 3px solid #d6a345; }
.balance-card { border-top: 3px solid #537fc5; }
.panel { margin-bottom: 20px; padding: 22px; }
.section-heading { margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.text-link { color: var(--green); font-size: 13px; font-weight: 700; }
.pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #edf4ef; color: var(--green-dark); font-size: 11px; font-weight: 700; white-space: nowrap; }
.review-panel { border-color: #efdfbf; background: #fffdf8; }
.draft-list { display: grid; gap: 10px; }
.draft-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; align-items: center; padding: 13px; border: 1px solid #f0e8d8; border-radius: 9px; background: white; }
.draft-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.row-actions, .form-actions { display: flex; align-items: center; gap: 8px; }
.row-actions form { margin: 0; }
.attachment-name { grid-column: 1 / -1; }
.entry-form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: #43564a; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #d8e1da; border-radius: 7px; background: white; color: var(--ink); font: inherit; font-size: 14px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c5e0d0; border-color: #6da483; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.amount-input { display: flex; gap: 7px; }
.amount-input select { width: 92px; }
.form-actions { justify-content: flex-end; }
.form-error { padding: 10px 12px; border-radius: 7px; background: #fff0ee; color: #9b3429; font-size: 13px; }
.notice { padding: 11px 13px; border-radius: 8px; background: #fff7e7; color: var(--amber); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ledger-table th, .ledger-table td { padding: 12px 10px; border-bottom: 1px solid #edf1ed; text-align: left; vertical-align: top; }
.ledger-table thead th { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.ledger-table tbody tr.has-entries { background: #fbfdfb; }
.ledger-table tbody th { min-width: 94px; white-space: nowrap; }
.day-number { margin-right: 7px; font-size: 14px; }
.day-name { color: var(--muted); font-weight: 500; }
.amount { text-align: right !important; white-space: nowrap; }
.expense-text, .danger-text { color: var(--red); }
.income-text { color: var(--green); }
.net-text { font-weight: 800; }
.entry-details { min-width: 370px; display: grid; gap: 7px; }
.entry-detail { display: grid; grid-template-columns: 8px minmax(110px, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 7px 8px; border: 1px solid #edf1ed; border-radius: 7px; background: white; }
.type-mark { width: 7px; height: 28px; border-radius: 5px; background: #8ca398; }
.type-expense { background: #d27d65; }
.type-income { background: #4f9b72; }
.type-miscellaneous { background: #d6a345; }
.entry-description { display: grid; gap: 3px; }
.entry-description strong { font-size: 12px; }
.entry-description small { color: var(--muted); font-size: 10px; }
.entry-amount { white-space: nowrap; }
.icon-link, .link-button { padding: 0; border: 0; background: none; color: var(--green); font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.link-button { color: var(--red); }
.entry-detail form { margin: 0; }
.year-selector { display: flex; align-items: center; gap: 8px; }
.year-selector label { display: block; }
.year-selector input { width: 100px; }
.month-card { display: block; padding: 18px; transition: transform .12s, box-shadow .12s; }
.month-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px #183a2518; }
.month-card .section-heading { margin-bottom: 13px; }
.month-card .section-heading h2 { font-size: 16px; }
.month-card-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f3f0; color: var(--muted); font-size: 12px; }
.month-card-row strong { color: var(--ink); text-align: right; }
.month-balance { margin-bottom: 11px; padding-top: 10px; color: var(--ink); font-weight: 700; }
.month-card .text-link { font-size: 11px; }
footer { padding: 0 20px 24px; color: var(--muted); text-align: center; font-size: 11px; }

.login-page { display: grid; min-height: 100vh; place-items: center; overflow-x: hidden; background: #f3f6f3; }
.login-layout { display: grid; width: min(100% - 40px, 1020px); min-height: 620px; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid #e3e9e4; border-radius: 22px; background: white; box-shadow: 0 28px 80px #173a2517; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 68px); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 56px; color: #183527; font-size: 15px; font-weight: 800; letter-spacing: -.03em; }
.login-brand-light { color: #789084; font-weight: 500; }
.login-brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: #e5f1e9; color: #17653e; font-size: 11px; letter-spacing: -.05em; }
.login-card .eyebrow { margin-bottom: 10px; }
.login-card h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 40px); }
.login-subtitle { margin-bottom: 28px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 6px; color: #43564a; }
.login-form input { min-height: 46px; border-color: #dce5de; border-radius: 9px; }
.login-submit { min-height: 46px; justify-content: space-between; margin-top: 12px; padding-inline: 16px; border-radius: 9px; font-size: 14px; }
.login-submit span { font-size: 18px; }
.login-security { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; color: #87958c; font-size: 11px; }
.login-security span { color: #399268; font-size: 9px; }
.login-card .form-error { margin: 0 0 15px; }
.login-aside { position: relative; display: flex; min-height: 100%; align-items: center; overflow: hidden; padding: 54px; background: radial-gradient(ellipse at 85% 15%, #317c5666, transparent 38%), linear-gradient(145deg, #123c2a, #10271e 76%); color: white; }
.login-orbit { position: absolute; width: 360px; height: 360px; border: 1px solid #b4e0c21c; border-radius: 50%; }
.login-orbit-one { top: -150px; right: -80px; }
.login-orbit-two { right: -180px; bottom: -180px; width: 480px; height: 480px; }
.login-aside-content { position: relative; z-index: 1; max-width: 370px; }
.login-aside-kicker { color: #a7d4b8; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-aside h2 { margin: 18px 0 14px; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.045em; line-height: 1.1; }
.login-aside-content p { max-width: 320px; color: #d0e0d5; font-size: 14px; line-height: 1.7; }
.login-aside-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.login-aside-chips span { padding: 8px 10px; border: 1px solid #ffffff24; border-radius: 999px; background: #ffffff0b; color: #e0eee5; font-size: 10px; }
.login-aside-footer { position: absolute; right: 26px; bottom: 22px; color: #aac3b3; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.login-aside-footer span { margin: 0 5px; color: #7bc090; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-table { min-width: 1000px; }
  .login-layout { min-height: 580px; }
  .login-aside { padding: 34px; }
}
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; padding: 15px 20px; }
  .topbar nav { width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 12px; }
  .business-switcher-shell { width: calc(100% - 24px); align-items: flex-start; flex-direction: column; gap: 8px; margin-top: 12px; padding: 12px; }
  .business-switcher { width: 100%; gap: 6px; }
  .business-option { min-width: 0; flex: 1; gap: 8px; padding: 8px; }
  .business-mark { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
  .business-active-indicator { display: none; }
  .business-option-copy strong { font-size: 11px; }
  .business-option-copy small { font-size: 9px; }
  .container { width: calc(100% - 24px); margin-top: 22px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .month-nav { width: 100%; }
  .month-nav form { flex: 1; }
  .month-nav input { min-width: 0; }
  .summary-grid { gap: 9px; }
  .summary-card { min-height: 92px; padding: 13px; }
  .summary-card strong { font-size: 18px; }
  .panel { padding: 15px; }
  .draft-row { grid-template-columns: 1fr; }
  .row-actions { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .year-selector { width: 100%; }
  .year-selector input { flex: 1; }
  .login-page { display: block; min-height: 100vh; padding: 16px 0; }
  .login-layout { display: block; width: calc(100% - 24px); min-height: unset; border-radius: 16px; }
  .login-card { padding: 30px 24px 34px; }
  .login-brand { margin-bottom: 42px; }
  .login-aside { display: none; }
}
