:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182b27;
  background: #f3f5f1;
  --surface: #fff;
  --line: #e0e6de;
  --muted: #5c6e65;
  --green: #126c52;
  --sidebar: #112420;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 223px minmax(0, 1fr); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #51a78c; outline-offset: 2px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--sidebar); color: #eaf6ef; padding: 32px 17px 19px;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px; font-size: 16px; font-weight: 730; letter-spacing: -.25px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; background: #bce9a2;
  color: #123b29; border-radius: 11px; font-size: 23px; line-height: 1;
}
.brand small { display: block; font-size: 11px; color: #adc1b5; margin-top: 4px; font-weight: 500; letter-spacing: .2px; }
nav { display: grid; gap: 5px; margin-top: 43px; }
nav a, .backup { display: flex; align-items: center; gap: 11px; min-height: 45px; padding: 0 11px; color: #c7d7cf; font-size: 14px; border-radius: 9px; }
nav a:hover, .backup:hover { background: #1d3930; color: white; }
nav a[aria-current] { background: #254638; color: #dbf9cc; font-weight: 650; }
.nav-icon { width: 20px; text-align: center; font-size: 20px; line-height: 1; }
.sidebar-bottom { margin-top: auto; }
.environment { margin: 12px 5px 0; padding: 14px 5px 2px; border-top: 1px solid #304940; color: #a8bcb1; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.environment > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #a4df85; }
main { width: 100%; max-width: 1610px; margin: 0 auto; padding: 36px clamp(24px, 3.3vw, 57px) 45px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 26px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(31px, 3.1vw, 45px); line-height: 1.06; letter-spacing: -.05em; margin-bottom: 10px; }
.page-description { font-size: 14px; color: var(--muted); margin-bottom: 0; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button { min-height: 41px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; white-space: nowrap; font-size: 13px; font-weight: 690; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: #0d5a43; }
.secondary { color: #25483c; background: #fff; border-color: var(--line); }
.secondary:hover { background: #f2f7ef; }
.danger { color: #9a332b; background: #fff1ef; margin-right: auto; }
.month-control { display: flex; position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff; align-items: center; color: #264137; }
.month-control > button { border: 0; min-height: 39px; background: transparent; padding: 0 9px; color: inherit; font-size: 21px; }
.month-control > button:hover { background: #edf5eb; border-radius: 6px; }
.month-control #open-month { font-size: 13px; font-weight: 680; min-width: 111px; }
.month-picker { position: absolute; right: 0; top: calc(100% + 8px); width: 223px; padding: 13px; background: white; border: 1px solid var(--line); border-radius: 9px; z-index: 2; box-shadow: 0 12px 24px #13292216; }
.month-picker .button { margin-top: 10px; width: 100%; }
.month-picker-fields { display: grid; grid-template-columns: 1fr 75px; gap: 8px; margin-top: 5px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric, .panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.metric { min-width: 0; padding: 17px; }
.metric-label { display: flex; align-items: center; gap: 8px; color: #344a41; font-size: 13px; font-weight: 690; margin-bottom: 14px; }
.metric-icon { flex: 0 0 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; font-size: 16px; }
.green { color: #0c6348; background: #e2f5e9; }
.orange { color: #9b4e24; background: #fceddc; }
.blue { color: #415d8b; background: #eaf0fd; }
.metric strong { display: block; font-size: clamp(16px, 2vw, 28px); letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric p { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 8px 0 0; }
.profit { color: #183727; background: #e4f4da; border-color: #d4e9ca; }
.profit .metric-icon { color: #275d39; background: #cee8c1; }
.overview-grid { display: grid; grid-template-columns: 1.33fr 1fr; gap: 14px; margin: 17px 0; }
.panel { min-width: 0; }
.panel-heading { padding: 19px 20px 0; }
.panel-heading h2 { font-size: 17px; letter-spacing: -.035em; margin-bottom: 5px; }
.panel-heading p { color: var(--muted); font-size: 12px; margin-bottom: 0; line-height: 1.45; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.flow { padding: 18px 20px 0; }
.bar-heading, .forecast, .legend > div, .legend span { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.bar-heading strong, .forecast strong, .legend strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
progress { appearance: none; display: block; width: 100%; height: 8px; margin: 7px 0 13px; border: 0; border-radius: 99px; overflow: hidden; background: #edf1ec; color: var(--bar); }
progress::-webkit-progress-bar { background: #edf1ec; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--bar); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--bar); border-radius: 99px; }
.inbound { --bar: #38866b; }
.outbound { --bar: #e3a166; }
.forecast { margin: 0 20px; padding: 12px 0 14px; border-top: 1px solid var(--line); color: var(--muted); }
.forecast strong { color: #25483c; }
.breakdown { min-height: 157px; padding: 16px 20px 20px; display: flex; align-items: center; gap: 17px; }
.donut { position: relative; isolation: isolate; width: 105px; height: 105px; background: #e8eee7; border-radius: 50%; display: grid; place-items: center; flex: 0 0 105px; }
.donut::before { content: ""; position: absolute; z-index: -1; inset: 13px; border-radius: 50%; background: white; }
.donut span { color: var(--muted); font-size: 11px; }
.legend { flex: 1; min-width: 0; }
.legend > div { padding: 10px 0; }
.legend > div + div { border-top: 1px solid var(--line); }
.swatch { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 3px; }
.swatch.salary { background: #548e76; }
.swatch.expense { background: #e3a166; }
.records-panel .panel-heading { margin-bottom: 14px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; text-align: left; width: 100%; font-size: 13px; }
thead { background: #f5f7f3; color: #52675e; font-size: 11px; }
th, td { padding: 10px 12px; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody tr + tr { border-top: 1px solid #edf0eb; }
td { height: 46px; }
td:first-child, .money { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.party-cell { min-width: 130px; max-width: 310px; overflow-wrap: anywhere; }
td.party-cell small { display: block; color: var(--muted); margin-top: 3px; }
.badge { border-radius: 6px; padding: 4px 6px; display: inline-block; white-space: nowrap; font-size: 10px; font-weight: 650; }
.badge.income { color: #176447; background: #e6f5e9; }
.badge.salary { color: #3c5580; background: #ebf0fa; }
.badge.expense { color: #88421b; background: #fbefde; }
.muted { color: var(--muted); }
.negative { color: #a03e30 !important; }
.edit-button { padding: 5px 8px; background: #fff; color: var(--green); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; font-weight: 680; }
.edit-button:hover { background: #eef5eb; }
.empty { display: grid; justify-items: center; row-gap: 7px; padding: 30px 16px; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid var(--line); }
.empty strong { color: #29473e; }
.empty .button { margin-top: 5px; }
.filters, .mapping-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.filters { padding: 0 20px 15px; }
.filters .search { flex: 1 1 200px; max-width: 340px; }
label { display: block; color: #354c42; font-size: 13px; font-weight: 650; }
input:not([type=file]), textarea, select { display: block; width: 100%; min-width: 0; min-height: 39px; padding: 7px 9px; border: 1px solid #d9e2d9; border-radius: 7px; background: #fff; color: #182b27; }
label input:not([type=file]), label select, label textarea { margin-top: 5px; }
label small { color: var(--muted); font-weight: 400; }
.import-panel + .import-panel { margin-top: 16px; }
.import-body { padding: 18px 20px; }
.drop {
  display: grid; justify-items: center; text-align: center; gap: 6px; padding: 30px 14px;
  background: #f7faf5; border: 1px dashed #8db59e; border-radius: 9px; cursor: pointer;
}
.drop > span { color: var(--green); font-size: 24px; line-height: 1; }
.drop:hover { background: #eef6eb; }
.drop input { width: min(100%, 255px); margin-top: 6px; }
.mapping-controls { margin-bottom: 14px; }
.mapping-controls label { flex: 1 1 140px; }
#selected-file { font-size: 12px; margin: 10px 0; }
#import-preview .panel-heading { margin-bottom: 14px; }
#import-issues { margin-bottom: 12px; font-size: 13px; color: #814327; }
#import-issues ul { padding-left: 21px; }
.message { padding: 9px 13px; border-radius: 7px; font-size: 13px; }
.error { color: #8d3029; background: #faeeec; }
dialog { width: min(475px, calc(100% - 24px)); color: #182b27; border: 1px solid var(--line); border-radius: 14px; padding: 21px; box-shadow: 0 18px 65px #152f2740; }
dialog::backdrop { background: #12291fcc; }
#record-form { display: grid; gap: 12px; }
.dialog-title, .dialog-actions { display: flex; align-items: center; gap: 8px; }
.dialog-title { justify-content: space-between; }
.dialog-title h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.icon-button { border: 0; background: #f2f5f1; color: #2b4d3e; width: 34px; height: 34px; border-radius: 6px; font-size: 21px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
textarea { resize: vertical; }
.people { display: flex; gap: 6px; }
.people button { padding: 4px 9px; border: 1px solid #cfe5d6; background: #ecf6ec; color: #1e664a; border-radius: 6px; font-size: 12px; }
.dialog-actions { justify-content: flex-end; }
.toast { position: fixed; right: 24px; bottom: 16px; margin: 0; max-width: calc(100% - 48px); padding: 12px 15px; border-radius: 9px; color: #fff; background: #203d33; box-shadow: 0 8px 25px #13292233; z-index: 3; font-size: 13px; }
@media (max-width: 1110px) {
  .cards { gap: 9px; }
  .metric { padding: 13px; }
  .breakdown { gap: 10px; }
  .donut { width: 78px; height: 78px; flex-basis: 78px; }
  .donut::before { inset: 9px; }
}
@media (max-width: 900px) {
  body { grid-template-columns: 175px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .breakdown { flex-direction: column; align-items: stretch; }
  .donut { align-self: center; flex-basis: auto; }
}
@media (max-width: 665px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 10px 8px; }
  nav { display: flex; flex-wrap: wrap; margin-top: 10px; }
  nav a, .backup { min-height: 33px; padding: 0 7px; gap: 4px; font-size: 12px; }
  .sidebar-bottom { display: flex; align-items: center; flex-wrap: wrap; margin-top: 4px; }
  .environment { border: 0; padding: 0; margin: 0 7px; }
  main { padding: 22px 13px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .overview-grid { grid-template-columns: 1fr; }
  .breakdown { flex-direction: row; align-items: center; }
  .metric p, .panel-heading p { font-size: 11px; }
  th, td { padding-inline: 8px; }
}

.turnover-panel { margin-top: 20px; padding: clamp(16px, 3vw, 28px); }
.turnover-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: clamp(20px,4vw,52px); }
.turnover-grid figure { margin: 0; min-width: 0; }
.turnover-grid figcaption { font-weight: 750; margin: 8px 0 14px; }
.turnover-row { display: grid; grid-template-columns: 4.3em minmax(16px,1fr) auto; gap: 8px; align-items: center; padding: 5px 0; font-size: .84rem; }
.turnover-row strong { min-width: 8em; text-align: right; font-variant-numeric: tabular-nums; }
#turnover-changes strong { min-width: 5em; }
.turnover-row progress { appearance: none; width: 100%; height: 8px; border: none; border-radius: 8px; overflow: hidden; background: #e7eee9; }
.turnover-row progress::-webkit-progress-bar { background: #e7eee9; }
.turnover-row progress::-webkit-progress-value { background: #418068; border-radius: 8px; }
.turnover-row progress::-moz-progress-bar { background: #418068; }
.turnover-row progress.decline::-webkit-progress-value { background: #ad6436; }
.turnover-row progress.decline::-moz-progress-bar { background: #ad6436; }
.turnover-note { font-size: .82rem; margin: 16px 0 0; color: #52675f; }
@media (max-width: 800px) { .turnover-grid { grid-template-columns: 1fr; } }
