﻿.finance {
  --ledger-green: #244f48;
  --ledger-paper: #edf5f1;
}
.finance .library-head {
  margin-bottom: 18px;
}
.sample-note,
.panel-title > span {
  font-size: 12px;
  color: var(--muted);
}
.ledger-nav {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.ledger-nav a {
  padding: 8px 0 11px;
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.ledger-nav a[aria-current] {
  border-bottom-color: var(--ledger-green);
  color: var(--ledger-green);
}
.meter-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.ledger-metric {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 16px 19px;
}
.ledger-metric span {
  font-size: 13px;
  color: #425369;
}
.ledger-metric strong,
.budget-facts dd {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.ledger-metric strong {
  font-weight: 600;
  font-size: clamp(24px, 2.4vw, 33px);
  letter-spacing: -0.035em;
}
.ledger-metric small,
.ledger small,
.fineprint {
  color: var(--muted);
  font-size: 12px;
}
.ledger-metric.lead {
  background: var(--ledger-green);
  border-color: var(--ledger-green);
  color: #fff;
}
.ledger-metric.lead span,
.ledger-metric.lead small {
  color: #d6e7de;
}
.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 20px 12px;
}
.panel-title h2,
#key-title {
  font-size: 17px;
  margin: 0;
}
.panel-title a,
#context a {
  color: var(--blue);
  font-size: 13px;
}
.finance .list-tools {
  padding-top: 3px;
}
.ledger-scroll {
  overflow: auto;
}
.ledger {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 650px;
  width: 100%;
  table-layout: fixed;
}
.ledger th,
.ledger td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #e3e8eb;
  vertical-align: middle;
}
.ledger th:first-child,
.ledger td:first-child {
  padding-left: 20px;
}
.ledger th {
  font-weight: 600;
  font-size: 12px;
  background: #f6f8f8;
  color: #516272;
}
.ledger th:first-child {
  width: 38%;
}
.ledger .sum {
  font-weight: 700;
  color: var(--ledger-green);
}
.ledger td {
  font-variant-numeric: tabular-nums;
}
.ledger tr:last-child td {
  border-bottom: 0;
}
.ledger small {
  display: block;
  margin-top: 4px;
}
.study-title {
  font-size: 14px;
  font-weight: 650;
  color: #2d4969;
  text-decoration: none;
}
.study-title:hover {
  text-decoration: underline;
}
.pending,
.run-state {
  font-size: 12px;
  display: inline-block;
  border-radius: 4px;
  padding: 2px 6px;
  background: #fff0d8;
  color: #825321;
}
.run-state.ok {
  background: #e5f4eb;
  color: #286449;
}
.run-state.failed {
  background: #fae9e4;
  color: #903f30;
}
.run-state.processing {
  background: #e8effc;
  color: #3c5993;
}
#context {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 15px;
}
#context h2 {
  margin: 0;
  font-size: 18px;
}
#context a:last-child {
  margin-left: auto;
}
#budget-panel {
  margin-bottom: 16px;
  scroll-margin: 12px;
}
.budget-body,
.config-body {
  padding: 3px 20px 16px;
}
.budget-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.budget-facts dt,
.key-meta dt {
  font-size: 12px;
  color: var(--muted);
}
.budget-facts dd {
  margin: 3px 0 0;
  font-size: 18px;
}
.budget-track {
  display: flex;
  height: 5px;
  background: #e8eceb;
  border-radius: 2px;
  overflow: hidden;
  margin: 12px 0;
}
.budget-track i {
  background: #49776b;
}
.budget-track b {
  background: #dda055;
}
.forecast {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}
.forecast select,
.config-body select {
  font: inherit;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px;
}
.within-budget {
  color: #245d46;
}
.insufficient {
  color: #98491f;
}
.fineprint {
  margin: 9px 0 0;
  line-height: 1.55;
}
.run-table th:first-child {
  width: 34%;
}
.run-table th:nth-child(2) {
  width: 20%;
}
.run-input {
  overflow-wrap: anywhere;
}
.empty-message {
  padding: 15px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.config-body label,
.config-body .input-label {
  font-weight: 650;
  font-size: 13px;
  display: block;
  margin: 10px 0 6px;
}
.config-body button:not(.library-primary) {
  border: 1px solid #c4cdd2;
  border-radius: 5px;
  background: white;
  padding: 7px 11px;
  color: var(--ink);
  font-size: 13px;
}
.key-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.key-line code {
  font-size: 16px;
  background: #f1f5f4;
  border-radius: 5px;
  padding: 8px 12px;
  letter-spacing: 0.05em;
  color: #35534c;
}
.key-meta {
  margin: 18px 0 12px;
}
.key-meta > div {
  display: flex;
  gap: 18px;
  margin: 7px 0;
  align-items: baseline;
}
.key-meta dt {
  min-width: 85px;
}
.key-meta dd {
  margin: 0;
  font-size: 13px;
}
.money-input {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(260px, 100%);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 9px;
  color: var(--muted);
}
.money-input input {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: 0;
  font: inherit;
  color: var(--ink);
}
.config-body .library-primary {
  margin-top: 12px;
}
.feedback {
  color: var(--ledger-green);
  font-size: 13px;
}
@media (max-width: 720px) {
  .finance .library-head {
    display: block;
  }
  .sample-note {
    display: block;
    margin-top: 8px;
  }
  .meter-row,
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  .meter-row {
    gap: 8px;
  }
  .ledger-metric {
    padding: 12px;
  }
  .ledger-metric strong {
    font-size: 24px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .panel-title,
  .budget-body,
  .config-body {
    padding-left: 13px;
    padding-right: 13px;
  }
  .budget-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #context a:last-child {
    margin-left: 0;
  }
  .ledger,
  .ledger tbody {
    display: block;
    min-width: 0;
  }
  .ledger thead {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
  }
  .ledger tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .ledger td,
  .ledger td:first-child {
    display: block;
    padding: 0;
    border: 0;
    font-size: 13px;
  }
  .ledger td:first-child {
    grid-column: 1/-1;
  }
  .ledger td:not(:first-child):before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 2px;
  }
  .run-table td:nth-child(2) {
    grid-column: span 2;
  }
  .run-table small {
    font-size: 11px;
  }
}
