:root {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  color: #1a1a1a;
  background: #ebe8e3;
}

body {
  margin: 0;
}

.top {
  background: #1b4332;
  color: #e8f5e9;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-inner {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
}

.nav-user {
  font-size: 0.85rem;
  opacity: 0.85;
  align-self: center;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
}

.nav a {
  color: #c8e6c9;
  text-decoration: none;
  font-size: 0.92rem;
}

.nav a:hover {
  color: #fff;
  text-decoration: underline;
}

.inline-logout {
  display: inline;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  color: #c8e6c9;
  cursor: pointer;
  font-size: 0.92rem;
  padding: 0;
  text-decoration: underline;
}

.wrap {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  font-size: 1.45rem;
  margin: 0 0 0.35rem;
}

h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

.meta {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: #444;
}

code {
  font-size: 0.8rem;
  word-break: break-all;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  border: 1px solid #d5d0c8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.stat-card strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin-bottom: 0.35rem;
}

.stat-card .num {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-card.negative .num {
  color: #9b2226;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #d5d0c8;
  margin-top: 0.5rem;
}

table.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.ledger th,
table.ledger td {
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #ece8e2;
  vertical-align: top;
}

table.ledger th {
  background: #f0ede8;
  font-weight: 650;
}

table.ledger td.num,
table.ledger th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.ledger tr:last-child td {
  border-bottom: none;
}

.row-actions {
  white-space: nowrap;
}

.row-actions a {
  margin-right: 0.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #e4e0db;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input,
select,
textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid #c9c4bc;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 450;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #2d6a4f;
  outline-offset: 1px;
  border-color: #2d6a4f;
}

.hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: #555;
}

fieldset.amounts {
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  border: 1px dashed #cbc6bf;
  border-radius: 8px;
}

legend {
  padding: 0 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.actions {
  margin-top: 0.25rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font-size: 1rem;
  font-weight: 650;
  color: #fff;
  background: #2d6a4f;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1b4332;
}

.btn-danger {
  background: #9b2226;
}

.btn-danger:hover {
  background: #6a040f;
}

.btn-ghost {
  background: transparent;
  color: #1b4332;
  border: 1px solid #2d6a4f;
}

.help {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  color: #333;
}

.help ul {
  margin: 0;
  padding-left: 1.2rem;
}

.note {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #fff8e6;
  border-radius: 6px;
  border: 1px solid #f0dfb0;
  font-size: 0.88rem;
}

.flash-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.flash {
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}

.flash-ok {
  background: #d8f3dc;
  border: 1px solid #95d5b2;
  color: #1b4332;
}

.flash-error {
  background: #ffe5e5;
  border: 1px solid #f28b82;
  color: #6a040f;
}

.login-box {
  max-width: 20rem;
}

.muted {
  color: #666;
  font-size: 0.9rem;
}

/* Amount rows: grayed when not used for selected transaction type */
label.field-inactive {
  opacity: 0.48;
  color: #5c5c5c;
}

label.field-inactive input {
  background: #e0ddd8;
  color: #666;
  cursor: not-allowed;
  border-color: #c5c2bc;
}

.field-help {
  font-weight: 400;
  font-size: 0.82rem;
  color: #444;
  margin: 0.35rem 0 0;
  max-width: 36rem;
}

.adjustment-help {
  margin-top: 0.25rem;
  padding: 0.5rem 0.65rem;
  background: #f5f3ef;
  border-radius: 6px;
  border: 1px solid #ddd9d2;
  font-size: 0.82rem;
  color: #333;
}

details.adjustment-details {
  margin-top: 0.35rem;
}

details.adjustment-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #1b4332;
  font-weight: 600;
}
