:root {
  --ink: #17362d; --muted: #6f817b; --green: #17624b; --green-2: #258466;
  --pale: #eef6f2; --cream: #f8f6f0; --white: #fff; --line: #dce7e2;
  --red: #b94a48; --red-pale: #fff1ef; --gold: #b88928; --shadow: 0 14px 40px rgba(30, 66, 55, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button, .button { cursor: pointer; }
.hidden { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 10% 5%, #d9eee5, transparent 35%), linear-gradient(140deg, #f9f7f1, #eef5f1); }
.login-card { width: min(100%, 420px); padding: 44px; border: 1px solid rgba(23,98,75,.1); border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); text-align: center; }
.brand-mark { width: 60px; height: 60px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 18px; color: white; background: var(--green); font-family: Georgia, serif; font-size: 24px; font-weight: 700; }
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 12px; font-size: 17px; }
.eyebrow { margin: 0 0 6px; color: var(--green-2); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-family: Georgia, serif; font-size: 34px; }
h2 { margin: 0; font-family: Georgia, serif; font-size: 22px; }
.muted { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 7px; color: #48625a; font-size: 13px; font-weight: 700; text-align: left; }
input, select { width: 100%; min-height: 46px; border: 1px solid #cadbd4; border-radius: 10px; padding: 10px 12px; outline: none; color: var(--ink); background: white; }
input:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(37,132,102,.12); }
.login-card form { display: grid; gap: 16px; margin-top: 28px; }
button, .button { min-height: 42px; padding: 10px 17px; border: 0; border-radius: 10px; text-decoration: none; text-align: center; font-weight: 750; transition: transform .15s, opacity .15s, background .15s; }
button:hover, .button:hover { transform: translateY(-1px); }
.primary { color: white; background: var(--green); }
.primary:hover { background: #104d3b; }
.secondary { color: var(--green); border: 1px solid #bcd2c9; background: rgba(255,255,255,.75); }
.ghost { color: var(--green); border: 1px solid var(--line); background: transparent; }
.full { width: 100%; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; font-weight: 650; }
.topbar { height: 74px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > span:last-child { display: grid; }
.brand strong { font-family: Georgia, serif; font-size: 18px; }
.brand small { color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: end; gap: 12px; }
.month-control { display: flex; align-items: center; gap: 10px; }
.month-control input { min-height: 40px; width: 165px; }
main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 56px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 26px; }
.hero h1 { margin: 0 0 5px; font-size: clamp(28px, 4vw, 40px); }
.hero p:last-child { margin: 0; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { padding: 21px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 6px 20px rgba(30,66,55,.04); position: relative; overflow: hidden; }
.metric::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: #9cb7ad; }
.metric.income::before { background: #2c9470; } .metric.expense::before { background: #d06b61; } .metric.profit::before { background: #17624b; } .metric.split::before { background: #c19a48; }
.metric span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.metric strong { display: block; margin-bottom: 5px; font-family: Georgia, serif; font-size: clamp(22px, 2.5vw, 29px); }
.metric small { color: #8a9893; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 8px 30px rgba(30,66,55,.045); }
.panel-header { padding: 22px 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #edf2ef; }
.segmented { display: flex; padding: 3px; border-radius: 9px; background: var(--pale); }
.segmented button { min-height: 32px; padding: 5px 10px; color: var(--muted); background: transparent; font-size: 12px; }
.segmented button.active { color: var(--green); background: white; box-shadow: 0 2px 8px rgba(23,54,45,.1); }
.transaction-list { max-height: 610px; overflow-y: auto; }
.transaction { display: grid; grid-template-columns: 44px minmax(0,1fr) auto auto auto; align-items: center; gap: 13px; padding: 15px 20px; border-bottom: 1px solid #edf2ef; }
.transaction:last-child { border-bottom: 0; }
.type-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--green); background: var(--pale); font-size: 19px; font-weight: 800; }
.transaction.despesa .type-icon { color: var(--red); background: var(--red-pale); }
.transaction-main { min-width: 0; }
.transaction-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-main small, .transaction-meta { color: var(--muted); font-size: 12px; }
.transaction-meta { text-align: right; }
.transaction-value { min-width: 105px; text-align: right; font-weight: 800; }
.transaction.despesa .transaction-value { color: var(--red); }
.row-menu { min-height: 34px; padding: 4px 8px; color: var(--muted); background: transparent; font-size: 19px; }
.row-actions { display: flex; }
.empty { padding: 56px 20px; text-align: center; }
.empty > span { width: 48px; height: 48px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--pale); font-size: 24px; }
.empty h3 { margin-bottom: 6px; }.empty p { color: var(--muted); }
.side-column { display: grid; gap: 18px; }
.person-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 11px; align-items: center; padding: 16px 20px; border-bottom: 1px solid #edf2ef; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-weight: 800; }
.avatar.gold { background: var(--gold); }
.person-row div { display: grid; }.person-row small { color: var(--muted); }.person-row b { font-family: Georgia, serif; font-size: 17px; }
.settlement { display: grid; gap: 5px; margin: 18px; padding: 16px; border-radius: 12px; background: var(--pale); }
.settlement small, .settlement span { color: var(--muted); }.settlement span { font-size: 11px; line-height: 1.4; }
.category-list { padding: 12px 20px 18px; }
.category-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 8px 0; font-size: 13px; }
.category-item span { color: var(--muted); }.category-item b { font-size: 13px; }
.category-bar { grid-column: 1/-1; height: 4px; border-radius: 9px; overflow: hidden; background: #edf2ef; }
.category-bar i { display: block; height: 100%; border-radius: inherit; background: #7aac99; }
.annual-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 18px; border-bottom: 1px solid #edf2ef; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; } th { color: var(--muted); background: #fafcfb; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr.selected td { background: var(--pale); font-weight: 750; } tbody tr { cursor: pointer; }
footer { padding: 22px; color: var(--muted); text-align: center; font-size: 12px; }
dialog { width: min(94vw, 620px); padding: 0; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 30px 80px rgba(15,42,34,.28); }
dialog::backdrop { background: rgba(16,40,33,.55); backdrop-filter: blur(3px); }
dialog form { padding: 24px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.icon-button { width: 38px; min-height: 38px; padding: 0; border-radius: 50%; color: var(--muted); background: #f0f4f2; font-size: 25px; }
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; padding: 4px; border-radius: 12px; background: #edf3f0; }
.type-picker label { display: block; }.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker span { display: block; padding: 10px; border-radius: 9px; text-align: center; }
.type-picker input:checked + span { color: white; background: var(--green); box-shadow: 0 3px 10px rgba(23,98,75,.2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }.form-grid .wide { grid-column: 1/-1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 360px; padding: 13px 18px; border-radius: 10px; color: white; background: #17362d; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }.toast.error { background: var(--red); }
@media (max-width: 900px) { .metrics { grid-template-columns: 1fr 1fr; }.content-grid { grid-template-columns: 1fr; }.transaction-list { max-height: none; } }
@media (max-width: 620px) {
  .topbar { height: auto; padding: 12px 16px; align-items: flex-start; }.brand small, .month-control span { display: none; }.header-actions { align-items: center; }.month-control input { width: 145px; }
  main { width: min(100% - 24px, 1240px); padding-top: 26px; }.hero { display: block; }.hero-actions { margin-top: 18px; }.hero-actions > * { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }.metric { padding: 15px; }.metric strong { font-size: 20px; }.metric small { font-size: 10px; }
  .panel-header { display: block; padding: 18px; }.segmented { margin-top: 14px; }.segmented button { flex: 1; }
  .transaction { grid-template-columns: 38px minmax(0,1fr) auto; padding: 13px 12px; gap: 9px; }.type-icon { width: 36px; height: 36px; }.transaction-meta { display: none; }.transaction-value { min-width: auto; }.row-actions { grid-column: 3; }.row-menu { padding: 0 5px; min-height: 24px; }
  .form-grid { grid-template-columns: 1fr; }.form-grid .wide { grid-column: auto; }.login-card { padding: 32px 24px; }
}
