:root {
  color: #1c1915;
  background: #f3efe6;
  font-family: "Segoe UI", sans-serif;
  line-height: 1.4;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0 auto;
  max-width: 1100px;
  padding: 28px 20px 64px;
}

h1, h2, p { margin: 0; }

h1 { font-family: Georgia, serif; font-size: 40px; font-weight: 600; }

h2 { font-size: 15px; letter-spacing: 0.02em; }

.eyebrow {
  color: #6d6458;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.top, .entry-head, .inline, .header-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.header-actions { flex-wrap: wrap; justify-content: end; }

.gate {
  max-width: 440px;
  margin: 48px auto;
  background: #fffdf8;
  border: 1px solid #e3dccf;
  border-radius: 14px;
  padding: 24px;
}

.gate form { display: grid; gap: 10px; }
.gate h1 { margin: 4px 0 16px; }
.pin-box { gap: 8px; }
.pin-box input { width: 110px; letter-spacing: 0.18em; }

.month { font-size: 14px; }

.month input { display: block; margin-top: 6px; }

.status {
  min-height: 1.4em;
  margin: 14px 0;
  color: #9a3412;
}

.figures, .sources, .split {
  display: grid;
  gap: 12px;
}

.figures { grid-template-columns: repeat(3, 1fr); }
.sources { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
.split { grid-template-columns: 1.1fr 0.9fr; margin-top: 12px; }

.bank-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-top: 12px;
  background: #fffdf8;
  border: 1px solid #e3dccf;
  border-radius: 14px;
  padding: 16px;
}

.bank-bar > div:first-child { flex: 1 1 100%; }

.figures article,
.sources article,
.split article,
.entry,
.balances {
  background: #fffdf8;
  border: 1px solid #e3dccf;
  border-radius: 14px;
  padding: 16px;
}

.balances { margin-top: 12px; }

.figure {
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.income { color: #1f6b45; }
.expense { color: #9a3412; }

.hint { margin-top: 6px; color: #6d6458; font-size: 13px; }

form, .books { margin-top: 12px; }

.movement-form, #movement-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

label { display: grid; gap: 4px; font-size: 13px; }
.wide { grid-column: span 2; }

input, select, button {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #d4cbbd;
  border-radius: 8px;
  padding: 8px 10px;
}

button {
  background: #1c1915;
  color: #f7f3ea;
  cursor: pointer;
}

.inline input { width: 120px; }
.category-add { margin-top: 10px; }
.category-add input { width: 220px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee6da; }
th { color: #6d6458; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin-top: 10px; }

.row-actions { display: flex; gap: 6px; justify-content: end; align-items: center; }
.account-edit input { width: 120px; }
.ghost {
  background: transparent;
  color: #1c1915;
  padding: 4px 8px;
}

.mydata-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.mydata-form .row-actions { grid-column: 1 / -1; justify-content: start; }

.group-toggle { align-items: center; font-size: 14px; }
tr.group-head td { background: #f7f3ea; font-weight: 600; }
tr.group-child td:first-child { padding-left: 18px; }

.category-line, .books div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #eee6da;
  font-variant-numeric: tabular-nums;
}

.empty { color: #6d6458; padding-top: 8px; }

@media (max-width: 900px) {
  .figures, .sources, .split, #movement-form { grid-template-columns: 1fr 1fr; }
  .wide { grid-column: span 2; }
}

@media (max-width: 640px) {
  .figures, .sources, .split, #movement-form, .top, .inline, .bank-bar, .mydata-form, .header-actions { grid-template-columns: 1fr; display: grid; }
  .wide { grid-column: auto; }
}
