@font-face {
  font-family: system-fallback;
  src: local("Arial");
  font-display: swap;
}
:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-fallback,
    sans-serif;
  color: #eee8d3;
  background: #382e0b;
  font-synthesis: none;
  --paper: #4c4030;
  --bg: #382e0b;
  --ink: #eee8d3;
  --muted: #c7c1aa;
  --line: #6c644f;
  --green: #70c79c;
  --soft: #554d3a;
  --accent: #ffbf29;
  --red: #ffad94;
  color-scheme: dark;
}
* {
  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: 0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #adbc7e;
  outline-offset: 3px;
}
button {
  color: inherit;
}
a {
  color: var(--green);
}
input,
select,
textarea {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  min-height: 48px;
  outline-offset: 2px;
}
textarea {
  resize: vertical;
  min-height: 85px;
}
input[type="file"] {
  padding: 9px;
}
input[type="color"] {
  width: 62px;
  padding: 6px;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 15px 0 6px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -1px;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.4px;
}
h3 {
  font-size: 16px;
}
.small {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.muted {
  color: var(--muted);
}
.mono {
  font-family: ui-monospace, monospace;
  word-break: break-all;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.between {
  justify-content: space-between;
}
.grow {
  flex: 1;
  min-width: 0;
}
.stack {
  display: grid;
  gap: 12px;
}
.spaced {
  margin-top: 22px;
}
.svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.shell {
  max-width: 1040px;
  margin: auto;
  padding: 0 30px 110px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(20px + env(safe-area-inset-top)) 30px 22px;
  margin: 0 -30px 26px;
  background: #42573f;
  border-radius: 0 0 30px 30px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -1px;
}
.brand-mark {
  background: #344a34;
  color: #eee8d3;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  font-size: 25px;
  font-weight: 500;
}
.book-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-button {
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
}
.icon-button:hover {
  background: var(--soft);
}
.status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.dot {
  width: 6px;
  height: 6px;
  background: #739772;
  border-radius: 50%;
  display: inline-block;
}
.dot.offline {
  background: #bd875b;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 24px;
  gap: 12px;
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.7px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 9px;
}
.period {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 0 3px;
  gap: 4px;
}
.period span {
  font-size: 13px;
  min-width: 120px;
  text-align: center;
  text-transform: capitalize;
}
.period button {
  width: 34px;
  height: 38px;
}
.hero {
  background: var(--paper);
  border-radius: 24px;
  color: var(--ink);
  padding: 29px 32px;
  position: relative;
  overflow: hidden;
}
.hero .eyebrow {
  color: var(--muted);
}
.balance {
  font-size: 44px;
  letter-spacing: -2px;
  font-weight: 550;
  margin: 8px 0 26px;
  line-height: 1.15;
}
.hero-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-top: 1px solid #ffffff26;
  padding-top: 20px;
}
.hero-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.hero-value {
  font-size: 22px;
  letter-spacing: -0.6px;
}
.amount-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff13;
  margin-right: 7px;
}
.layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 22px;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 23px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.text-button {
  background: none;
  padding: 8px 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}
.accounts {
  display: flex;
  gap: 9px;
  overflow: auto;
  padding: 15px 0 4px;
  scrollbar-width: none;
}
.pill {
  white-space: nowrap;
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 20px;
  font-size: 12px;
}
.pill.active {
  background: #42573f;
  color: #eee8d3;
  border-color: var(--green);
}
.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  width: 100%;
  text-align: left;
  background: none;
  border-bottom: 1px solid var(--line);
}
.category-row:last-child {
  border-bottom: 0;
}
.category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #8e9782;
  color: #fff8e7;
  flex-shrink: 0;
}
.category-label {
  font-size: 14px;
  font-weight: 550;
}
.bar {
  height: 4px;
  background: var(--soft);
  border-radius: 4px;
  margin-top: 9px;
  width: 100%;
  overflow: hidden;
}
.bar i {
  display: block;
  background: var(--green);
  height: 100%;
  border-radius: 4px;
}
.cat-sum {
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.cat-share {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  font-weight: 400;
}
.empty {
  text-align: center;
  padding: 35px 20px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}
.empty .category-icon {
  margin: 0 auto 15px;
  width: 52px;
  height: 52px;
  border-radius: 17px;
}
.empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
}
.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  background: none;
}
.entry:last-child {
  border: 0;
}
.entry-name {
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.entry-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.entry-sum {
  font-size: 15px;
  white-space: nowrap;
  font-weight: 600;
}
.entry-sum.income {
  color: #89d7a3;
}
.pending {
  font-size: 10px;
  color: #e9c98e;
  margin-top: 4px;
  text-align: right;
}
.day-heading {
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0 5px;
}
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 45px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 12px;
}
.nav a.active {
  color: var(--green);
  background: var(--soft);
  font-weight: 650;
}
.add-button {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  padding: 13px 20px;
  background: var(--accent);
  font-size: 14px;
  font-weight: 650;
  color: #382e0b;
  white-space: nowrap;
  min-height: 48px;
}
.primary {
  background: var(--accent);
  color: #382e0b;
  padding: 14px 20px;
  border-radius: 13px;
  min-height: 48px;
  font-weight: 600;
}
.secondary {
  background: var(--soft);
  color: var(--green);
  padding: 13px 18px;
  border-radius: 13px;
  min-height: 46px;
}
.danger {
  background: #663c32;
  color: var(--red);
  padding: 12px 16px;
  border-radius: 12px;
}
.full {
  width: 100%;
}
.search {
  display: flex;
  gap: 12px;
  margin: 20px 0 14px;
}
.search input {
  flex: 1;
  min-width: 0;
}
.search select {
  width: 145px;
}
.segmented {
  display: flex;
  background: var(--soft);
  border-radius: 13px;
  padding: 4px;
  gap: 3px;
}
.segmented button {
  flex: 1;
  background: none;
  border-radius: 10px;
  padding: 10px 5px;
  font-size: 13px;
}
.segmented .active {
  background: var(--paper);
  box-shadow: 0 1px 5px #22362f0c;
  font-weight: 600;
}
.list-total {
  font-size: 13px;
  color: var(--muted);
  padding: 14px 0 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.amount-input {
  font-size: 43px;
  text-align: center;
  font-weight: 500;
  padding: 22px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  letter-spacing: -1px;
  margin: 12px 0 2px;
}
.app-icon { border-radius: 25%; flex-shrink: 0; }
.amount-entry { display: flex; align-items: center; gap: 4px; }
.amount-entry .amount-input { min-width: 0; flex: 1; }
.amount-assistant {
  flex: 0 0 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 64px;
  padding: 8px 3px;
  font-size: 12px;
  color: var(--accent);
  background: transparent;
}
.draft-banner, .update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 14px;
}
.amount-currency {
  text-align: center;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 12px;
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.category-choice {
  background: none;
  border-radius: 13px;
  padding: 10px 3px;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid transparent;
  display: grid;
  justify-items: center;
  gap: 7px;
}
.category-choice.selected {
  border-color: #adc2a2;
  background: var(--soft);
  color: var(--ink);
}
.category-choice .category-icon {
  width: 64px;
  height: 64px;
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.form-actions > .primary {
  flex: 1;
}
.form-error {
  font-size: 13px;
  line-height: 1.5;
  color: var(--red);
  margin-top: 14px;
}
.error-banner {
  border: 1px solid #a88750;
  background: #55472f;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 18px;
}
.error-banner button {
  background: none;
  text-decoration: underline;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}
.setting-row:last-child {
  border: 0;
}
.setting-row .icon-button {
  width: 44px;
  height: 44px;
}
.badge {
  font-size: 11px;
  background: var(--soft);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--muted);
}
.key-box {
  background: var(--soft);
  border: 1px dashed #9aab96;
  border-radius: 13px;
  padding: 16px;
  margin: 18px 0;
  line-height: 1.6;
  user-select: all;
  font-size: 14px;
}
.qr {
  display: block;
  width: 220px;
  max-width: 100%;
  margin: 15px auto;
  image-rendering: pixelated;
}
.assistant {
  max-width: 690px;
  margin: auto;
}
.assistant-intro {
  padding: 26px 0;
  text-align: center;
}
.assistant-intro .brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 36px;
  margin-bottom: 20px;
}
.assistant-intro p {
  max-width: 390px;
  margin: 12px auto 0;
  line-height: 1.6;
}
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 23px;
}
.assistant-result {
  margin: 20px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14px;
}
.ai-input {
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 14px;
  background: var(--paper);
}
.ai-input textarea {
  border: 0;
  padding: 5px;
  min-height: 95px;
}
.ai-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ai-tools .row {
  gap: 2px;
}
.attachment {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  padding: 26px;
  width: calc(100% - 24px);
  max-width: 490px;
  max-height: 92dvh;
  overflow: auto;
  box-shadow: 0 20px 80px #0002;
}
dialog::backdrop {
  background: #172a2366;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}
.dialog-head button {
  margin: -10px;
}
.boot {
  min-height: 80dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--muted);
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 95px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 13px 20px;
  border-radius: 14px;
  max-width: 90vw;
  width: max-content;
  font-size: 13px;
  line-height: 1.5;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#toast.show {
  opacity: 1;
}
.token {
  font-size: 12px;
  overflow-wrap: anywhere;
  padding: 12px;
  background: var(--soft);
  border-radius: 10px;
}
.install-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  background: var(--soft);
  padding: 15px;
  border-radius: 13px;
  margin-top: 16px;
}
.checking {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #a8bba9;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
[hidden] {
  display: none !important;
}
.benchmark {
  max-width: 700px;
  margin: 30px auto;
  padding: 20px;
}
.benchmark pre {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 14px;
}
summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
}
.receipt-lines {
  max-height: 40vh;
  overflow: auto;
  font-size: 13px;
}
.receipt-lines > div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 700px) {
  .shell {
    padding: 0 20px 110px;
  }
  .topbar {
    padding: calc(16px + env(safe-area-inset-top)) 20px 18px;
    margin: 0 -20px 24px;
  }
  .brand {
    font-size: 21px;
  }
  .heading {
    margin: 4px 0 20px;
    align-items: flex-start;
  }
  h1 {
    font-size: 28px;
  }
  .layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 25px;
    border-radius: 22px;
  }
  .balance {
    font-size: 40px;
  }
  .panel {
    padding: 20px;
  }
  .nav {
    gap: 8px;
    justify-content: space-around;
    padding-top: 6px;
  }
  .nav a {
    flex-direction: column;
    gap: 5px;
    min-width: 60px;
    font-size: 10px;
    padding: 6px 12px;
  }
  .nav a.active {
    background: none;
  }
  .nav .svg {
    width: 23px;
    height: 23px;
  }
  .period span {
    min-width: 96px;
    font-size: 12px;
  }
  .period button {
    width: 44px;
    height: 44px;
  }
  .add-button {
    padding: 12px 15px;
    font-size: 13px;
  }
  .heading .add-button {
    margin-top: 2px;
  }
  .hero-value {
    font-size: 20px;
  }
  .book-title {
    max-width: 150px;
  }
  .topbar .status {
    font-size: 11px;
  }
  .search {
    gap: 7px;
  }
  .search select {
    width: 125px;
    padding: 10px;
  }
  .form-grid {
    gap: 10px;
  }
  .form-grid input,
  .form-grid select {
    padding: 11px;
  }
  .category-row {
    padding: 13px 0;
  }
  .assistant-intro {
    padding: 20px 0;
  }
  .assistant-intro h1 {
    font-size: 27px;
  }
  .assistant-intro .small {
    font-size: 14px;
  }
  .categories-grid {
    gap: 3px;
  }
  dialog {
    padding: 22px;
    max-height: 90dvh;
  }
  .form-actions {
    position: sticky;
    bottom: -22px;
    padding: 12px 0 22px;
    background: var(--paper);
    margin-bottom: -22px;
  }
  .nav {
    padding-bottom: calc(7px + env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.entry-name,
.entry-sub,
.cat-share,
.pending {
  display: block;
}
.form-grid > div {
  min-width: 0;
}
input[type="date"] {
  min-width: 0;
}
input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  vertical-align: middle;
  margin-right: 7px;
}
.primary .svg {
  vertical-align: middle;
  width: 18px;
  height: 18px;
}

.bar {
  display: block;
}

.topbar .status {
  color: #eee8d3;
}
.categories-grid .category-icon .svg {
  width: 34px;
  height: 34px;
}
.quick-dates {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.icon-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.icon-choice {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #8e9782;
  color: #fff8e7;
  display: grid;
  place-items: center;
  justify-self: center;
}
.icon-choice .svg {
  width: 30px;
  height: 30px;
}
.icon-choice[aria-pressed="true"] {
  background: var(--accent);
  color: #382e0b;
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.color-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}
.color-choice {
  width: 100%;
  min-width: 0;
  height: 44px;
  border-radius: 50%;
  border: 5px solid var(--paper);
}
.color-choice[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}
.color-palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}
.color-palette .color-choice {
  aspect-ratio: 1;
  height: auto;
  min-height: 44px;
}
.expense-chart {
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin: 12px auto 20px;
  position: relative;
}
.expense-chart > svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  fill: none;
  stroke-width: 17;
}
.chart-total {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.chart-total strong {
  font-size: clamp(20px, 5.5vw, 28px);
  font-weight: 500;
  letter-spacing: -1px;
}
@media (max-width: 700px) {
  .heading .add-button {
    position: fixed;
    right: 22px;
    bottom: calc(94px + env(safe-area-inset-bottom));
    z-index: 9;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    padding: 0;
    font-size: 0;
    gap: 0;
    justify-content: center;
    box-shadow: 0 5px 22px #0003;
  }
  .heading .add-button .svg {
    width: 30px;
    height: 30px;
  }
  .icon-picker {
    gap: 10px;
  }
}

.field-heading {
  margin-top: 16px;
}
.field-heading label {
  margin: 0;
}
.field-heading .text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
}
.category-choice {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
}
#icon-search {
  margin-bottom: 14px;
}
.icon-picker {
  margin-bottom: 14px;
}
.edit-hint {
  margin: 6px 0 10px;
}
@media (max-width: 700px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

.catalog-name input {
  min-width: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
