:root {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #233b33;
  background: #f6f7f3;
  font-synthesis: none;
  font-size: 15px;
  --green: #235849;
  --ink: #233b33;
  --muted: #6e7b72;
  --line: #dce3d8;
  --paper: #fff;
  --soft: #edf2e8;
  --red: #a94d3e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 15px;
  background: #fff;
  color: var(--ink);
  font-weight: 550;
}
button:hover {
  background: #edf2e8;
  border-color: #b7c7b4;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
button.primary:hover {
  background: #174739;
}
.quiet {
  background: transparent;
}
.small {
  padding: 6px 10px;
  font-size: 12px;
}
.icon-button {
  padding: 3px 9px;
  font-size: 25px;
  border: none;
  background: transparent;
}
a {
  color: var(--green);
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #a7bf82;
  outline-offset: 3px;
}
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  padding: 35px 22px 24px;
  background: #eaf0e5;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 34px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Georgia, serif;
  font-size: 29px;
  letter-spacing: -1px;
}
.brand img {
  width: 38px;
  height: 38px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 14px;
}
.scenario-list {
  display: grid;
  gap: 7px;
}
.scenario {
  background: transparent;
  text-align: left;
  border-color: transparent;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.scenario.active {
  background: #fff;
  border-color: #d8e0d0;
  box-shadow: 0 2px 3px #16342005;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8da778;
  flex-shrink: 0;
}
.sidebar .new {
  width: 100%;
  margin-top: 12px;
  border-style: dashed;
  background: transparent;
}
.sidebar-foot {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.sidebar-foot strong {
  display: block;
  color: var(--ink);
}
main {
  padding: 35px 48px 60px;
  max-width: 1550px;
  width: 100%;
  margin: auto;
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 32px;
  font-size: 12px;
  color: var(--muted);
}
.topline .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.save-state {
  font-size: 12px;
  white-space: nowrap;
}
.save-state.dirty {
  color: #ad6a1e;
}
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 25px;
}
h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -1.3px;
  margin: 0 0 9px;
}
h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 25px;
  margin: 0;
}
h3 {
  font-size: 15px;
  margin: 0;
}
.subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 25px;
  margin-bottom: 28px;
}
.tab {
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.tab.active {
  border-color: var(--green);
  color: var(--green);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 28px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 21px;
}
.stat .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
.stat .value {
  font-family: Georgia, serif;
  font-size: 31px;
  letter-spacing: -0.6px;
}
.stat .detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 9px;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 22px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 23px;
}
.panel-head .subtitle {
  margin-top: 7px;
}
.panel-head .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 25px;
}
.aside .panel {
  background: #edf2e8;
  padding: 22px;
  position: sticky;
  top: 25px;
}
.aside dl {
  font-size: 12px;
  margin: 24px 0;
}
.aside dt {
  color: var(--muted);
  margin-top: 16px;
}
.aside dd {
  margin: 5px 0;
  font-size: 15px;
}
.aside p {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.account {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf8;
  text-align: left;
}
.account .name {
  font-size: 12px;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account .amount {
  font-size: 19px;
  font-weight: 500;
}
.account .type {
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
}
.timeline-year {
  font-family: Georgia, serif;
  font-size: 23px;
  margin: 25px 0 17px 11px;
}
.event-list {
  position: relative;
  margin-left: 18px;
  border-left: 1px solid #cbd8c2;
  padding: 0 0 1px 25px;
}
.event {
  position: relative;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
}
.event:before {
  content: "";
  position: absolute;
  left: -31px;
  top: 29px;
  width: 9px;
  height: 9px;
  border: 2px solid #f6f7f3;
  background: #91a884;
  border-radius: 50%;
}
.event:hover {
  border-color: #a3b599;
  box-shadow: 0 3px 10px #233b3306;
}
.event-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf1e5;
  color: #47703a;
  font-size: 17px;
  flex-shrink: 0;
}
.event-icon.expense {
  background: #f4ebe3;
  color: #aa754e;
}
.event-icon.change {
  background: #edf0f8;
  color: #6a7b9a;
}
.event-body {
  flex: 1;
  min-width: 0;
}
.event-name {
  font-size: 14px;
  font-weight: 600;
  margin: 1px 0 6px;
}
.event-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.event-amount {
  text-align: right;
  white-space: nowrap;
  font-size: 15px;
}
.event-amount small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}
.empty {
  padding: 45px 25px;
  text-align: center;
  border: 1px dashed #bcccb5;
  border-radius: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.empty h2 {
  color: var(--ink);
  margin-bottom: 12px;
}
.empty button {
  margin: 12px 4px;
}
.welcome {
  max-width: 680px;
  margin: 8vh auto;
  text-align: center;
}
.welcome .brand {
  justify-content: center;
  margin-bottom: 40px;
}
.welcome h1 {
  font-size: 49px;
  line-height: 1.14;
}
.welcome p {
  color: var(--muted);
  line-height: 1.8;
}
.welcome .primary {
  margin: 20px 6px;
}
.chart-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.chart-controls label {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chart {
  width: 100%;
  height: 300px;
  display: block;
}
.chart text {
  font-family: inherit;
  font-size: 11px;
  fill: #7b887c;
}
.legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-top: 15px;
}
.legend label {
  display: flex;
  align-items: center;
  gap: 7px;
}
.legend i {
  width: 17px;
  height: 3px;
  border-radius: 3px;
}
.table-wrap {
  overflow: auto;
  max-height: 600px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}
th {
  text-align: right;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}
td {
  text-align: right;
  padding: 13px 11px;
  border-bottom: 1px solid #edf0e9;
}
td:first-child,
th:first-child {
  text-align: left;
}
tr:hover td {
  background: #f7f9f3;
}
.negative,
.error {
  color: var(--red);
}
.notice {
  background: #f9f2e3;
  color: #816331;
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 18px;
}
.notice p {
  margin: 3px 0;
}
details {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 16px 0;
}
summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 500;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(720px, calc(100vw - 24px));
  max-height: 90vh;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 20px 90px #10221944;
}
dialog.wide {
  width: min(1100px, calc(100vw - 24px));
}
dialog::backdrop {
  background: #14291f66;
  backdrop-filter: blur(3px);
}
#editor {
  padding: 27px;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 25px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.form-grid .full {
  grid-column: 1/-1;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 550;
}
.derived-value {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 20px;
  font-weight: 600;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  background: white;
  color: var(--ink);
  border: 1px solid #ccd7c5;
  border-radius: 7px;
  padding: 10px;
  font-size: 14px;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #48784f;
  box-shadow: 0 0 0 3px #cfe0c433;
}
input:not([type="checkbox"]):not([type="file"]),
select {
  height: 44px;
  line-height: 1.4;
}
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 14px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input::-webkit-date-and-time-value {
  text-align: left;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}
textarea {
  min-height: 85px;
  resize: vertical;
}
.help {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
}
.form-section {
  margin: 22px 0 15px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.danger {
  color: var(--red);
  border-color: #e6d2cd;
  background: white;
}
.source-link {
  font-size: 11px;
}
.import-row {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 16px;
  margin: 14px 0;
}
.import-row .form-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
}
.import-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}
.import-heading input {
  flex-shrink: 0;
}
.import-heading a {
  margin-left: auto;
  font-weight: 400;
}
.loading {
  padding: 60px;
  text-align: center;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  background: #233b33;
  color: white;
  padding: 13px 20px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: 0 5px 20px #0002;
  z-index: 20;
  display: none;
}
.mobile-brand {
  display: none;
}
.footnote {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 20px;
}
.form-error {
  color: var(--red);
}
.split {
  display: flex;
  gap: 8px;
}
.check-list {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.check-list label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}
.hidden {
  display: none !important;
}
@media (min-width: 1600px) {
  main {
    padding: 45px 65px;
  }
}
@media (max-width: 1150px) {
  main {
    padding: 28px;
  }
  .timeline-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .aside .panel {
    position: static;
  }
  .aside dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 10px 0;
  }
  .aside dt {
    margin: 10px 0;
  }
  .aside dd {
    margin: 10px 0;
  }
  .sidebar {
    padding: 28px 16px;
  }
  .shell {
    grid-template-columns: 205px minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 18px;
    gap: 15px;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand {
    font-size: 24px;
  }
  .sidebar .brand img {
    width: 30px;
    height: 30px;
  }
  .sidebar .eyebrow,
  .sidebar-foot {
    display: none;
  }
  .scenario-list {
    display: flex;
    overflow: auto;
    gap: 5px;
  }
  .scenario {
    width: auto;
    min-width: max-content;
    padding: 9px 12px;
  }
  .sidebar .new {
    margin: 0;
    width: auto;
  }
  .scenario-section {
    display: flex;
    gap: 8px;
    min-width: 0;
  }
  .scenario-section > div {
    min-width: 0;
    flex: 1;
  }
  .sidebar .new {
    flex-shrink: 0;
    font-size: 12px;
  }
  main {
    padding: 23px 16px;
  }
  .topline {
    margin-bottom: 25px;
  }
  .topline .actions {
    gap: 5px;
  }
  .topline .actions button {
    padding: 7px 10px;
    font-size: 11px;
  }
  .save-state {
    font-size: 10px;
  }
  .title-row {
    align-items: flex-start;
  }
  h1 {
    font-size: 33px;
  }
  .title-row > button {
    font-size: 12px;
    padding: 9px 12px;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 14px 10px;
  }
  .stat .value {
    font-size: 23px;
  }
  .stat .label {
    font-size: 10px;
  }
  .stat .detail {
    font-size: 10px;
    line-height: 1.4;
  }
  .panel {
    padding: 18px;
  }
  .panel-head {
    gap: 10px;
    align-items: flex-start;
  }
  .panel-head h2 {
    font-size: 22px;
  }
  .panel-head .actions button {
    font-size: 10px;
    padding: 7px 8px;
  }
  .account-grid {
    gap: 8px;
  }
  .account .amount {
    font-size: 17px;
  }
  .event {
    padding: 15px 12px;
    gap: 9px;
  }
  .event-list {
    padding-left: 19px;
    margin-left: 7px;
  }
  .event:before {
    left: -25px;
  }
  .event-icon {
    width: 26px;
    height: 26px;
  }
  .event-name {
    font-size: 13px;
  }
  .event-amount {
    font-size: 13px;
  }
  .chart {
    height: 245px;
  }
  .form-grid {
    gap: 14px;
  }
  .import-row .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  #editor {
    padding: 20px;
  }
  .welcome h1 {
    font-size: 38px;
  }
  .topline > .breadcrumb {
    display: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button,
  .event {
    transition:
      background 0.15s,
      border-color 0.15s,
      box-shadow 0.15s;
  }
}
