.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.nav-wrap {
  max-width: 1280px;
  margin: auto;
  display: flex;
  align-items: center;
  height: 76px;
  padding: 0 40px;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  font-weight: 650;
  font-size: 23px;
  letter-spacing: -1px;
}
.brand-icon {
  width: 32px;
  height: 32px;
  display: block;
  margin-right: 11px;
}
.dark .brand-icon {
  filter: invert(1);
}
.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  line-height: 1;
  white-space: nowrap;
}
.brand-separator {
  display: inline-flex;
  align-self: center;
  flex: 0 0 0.65em;
  width: 0.65em;
  height: 0.65em;
  color: var(--muted);
  opacity: 0.75;
  transform: translateY(0.03em);
}
.brand-separator svg {
  width: 100%;
  height: 100%;
}
.brand-product {
  color: #704d85;
  font-size: 0.9em;
  font-weight: 400;
  letter-spacing: -0.25px;
}
.dark .brand-product {
  color: #9475a5;
}
.nav-active {
  font-size: 13px;
  align-self: stretch;
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--text);
  padding: 2px 1px 0;
  margin-left: 22px;
}
.local-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #15a373;
  box-shadow: 0 0 0 3px #15a37312;
}
.icon-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  transition:
    background-color 0.15s,
    color 0.15s;
}
.icon-button:hover:not(:disabled) {
  background: var(--soft);
}
#theme-toggle {
  border: 0;
  margin-left: -14px;
}
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 54px 40px 0;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.6px;
  color: var(--muted);
  font-weight: 550;
  margin-bottom: 11px;
}
h1 {
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -1.25px;
  font-weight: 600;
}
.page-heading p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
.primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-sm);
}
.primary:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--primary) 90%, var(--surface));
}
.outline {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.outline:hover {
  background: var(--soft);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 14px;
  gap: 10px;
}
.stat-label > svg,
.stat-symbol {
  color: var(--muted);
}
.stat-label svg {
  width: 15px;
  height: 15px;
}
.stat-number {
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1px;
  margin: 16px 0 12px;
  font-variant-numeric: tabular-nums;
}
.stat-description {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  gap: 5px;
  white-space: nowrap;
}
.mini-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}
.mini-dot.buy {
  background: var(--green);
}
.mini-dot.sell {
  background: var(--orange);
}
.mini-dot.swap {
  background: var(--purple);
}
.stat-percent {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}
.ledger {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.ledger-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  gap: 18px;
}
h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.35px;
}
.ledger-heading p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}
.file-actions {
  display: flex;
  gap: 8px;
}
.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 20px;
  gap: 16px;
}
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius-md);
  padding: 3px;
  background: var(--soft);
}
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-weight: 500;
}
.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px #00000014;
}
.tab > span {
  background: var(--soft);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 5px;
  font-size: 10px;
  min-width: 17px;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  width: 280px;
  height: 36px;
  border: 1px solid var(--line);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.search svg {
  width: 14px;
  height: 14px;
}
.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search:focus-within {
  outline: 3px solid color-mix(in srgb, var(--ring) 50%, transparent);
  outline-offset: 0;
  border-color: var(--ring);
}
.search input:focus {
  outline: none;
}
.search input::placeholder {
  color: var(--muted);
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  text-align: left;
  width: 100%;
  font-size: 12px;
  white-space: nowrap;
}
thead {
  background: transparent;
}
th {
  height: 44px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
th:first-child,
td:first-child {
  padding-left: 25px;
  width: 16%;
}
th:nth-child(2) {
  width: 18%;
}
th:nth-child(3),
th:nth-child(4) {
  width: 21%;
}
th:nth-child(5) {
  width: 19%;
}
th:last-child,
td:last-child {
  padding-right: 20px;
  text-align: right;
}
.sort-button {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 32px;
  border-radius: var(--radius-sm);
}
.sort-button svg {
  width: 12px;
  height: 12px;
}
td {
  height: 72px;
  border-bottom: 1px solid var(--line);
  padding-right: 16px;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--soft) 45%, var(--surface));
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  padding: 3px 8px;
  font-weight: 500;
  border: 1px solid transparent;
}
.badge svg {
  width: 12px;
  height: 12px;
}
.badge.buy {
  color: var(--green);
  background: var(--green-soft);
}
.badge.sell {
  color: var(--orange);
  background: var(--orange-soft);
}
.badge.swap {
  color: var(--purple);
  background: var(--purple-soft);
}
.currency {
  display: flex;
  align-items: center;
  gap: 8px;
}
.coin {
  width: 27px;
  height: 27px;
  border: 1px solid var(--line);
  background: var(--soft);
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  color: var(--muted);
  font-weight: 550;
}
.coin.btc {
  background: #fff6e8;
  color: #d38b22;
  border-color: #f5e4c5;
}
.coin.eth {
  background: #f0f1ff;
  color: #707baf;
  border-color: #e5e7fb;
}
.coin.eur {
  background: var(--green-soft);
  color: var(--green);
  border-color: transparent;
}
.amount {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ticker {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
}
.note-cell {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
}
.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.row-actions button {
  border: 0;
  width: 32px;
  height: 32px;
  background: transparent;
}
.row-actions svg {
  width: 16px;
  height: 16px;
}
.delete-action {
  color: var(--muted);
}
.delete-action:hover {
  color: var(--destructive);
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 302px;
  text-align: center;
  padding: 35px 20px;
}
.empty-icon {
  width: 47px;
  height: 47px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--soft);
  box-shadow: none;
  margin-bottom: 18px;
  color: var(--muted);
}
.empty-icon svg {
  width: 21px;
  height: 21px;
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.empty-state p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  margin-top: 8px;
  margin-bottom: 19px;
}
.empty-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.table-footer {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 7px;
}
.pagination > span {
  margin-right: 12px;
}
.pagination .icon-button {
  width: 32px;
  height: 32px;
}
.pagination svg {
  width: 16px;
  height: 16px;
}
.privacy-note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
  padding: 25px 0;
  line-height: 1.7;
}
.privacy-note > svg {
  width: 14px;
  height: 14px;
  margin-top: 2px;
}
.privacy-note strong {
  font-weight: 500;
  color: var(--text);
}
footer {
  margin-top: 35px;
  border-top: 1px solid var(--line);
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
footer > span:first-child {
  font-size: 16px;
  letter-spacing: -0.7px;
  color: var(--muted);
  font-weight: 600;
}
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0;
  width: 512px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 10px 15px -3px #0000001a,
    0 4px 6px -4px #0000001a;
  outline: none;
}
dialog::backdrop {
  background: #0008;
  backdrop-filter: none;
}
#transaction-form {
  padding: 24px;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 12px;
}
.dialog-heading h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.dialog-heading p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 7px;
  line-height: 1.6;
}
.dialog-heading .icon-button {
  border: 0;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--muted);
}
form > label {
  margin-top: 16px;
}
form label {
  display: block;
  font-size: 14px;
  font-weight: 500;
}
form input,
form select {
  width: 100%;
  height: 36px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 7px;
  padding: 0 12px;
  font-size: 14px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
form input:read-only {
  background: var(--soft);
  color: var(--muted);
}
.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
}
.amount-section {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 20px;
}
.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}
.optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.form-error {
  color: var(--destructive);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 12px;
}
.form-error:empty {
  display: none;
}
.delete-content {
  padding: 24px;
}
.delete-content h2 {
  font-size: 18px;
  margin-top: 18px;
}
.delete-content p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 10px;
}
.delete-icon {
  display: grid;
  place-items: center;
  background: var(--destructive-soft);
  color: var(--destructive);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
}
.danger {
  background: #dc2626;
  color: #fff;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: auto;
  transform: none;
  background: var(--surface);
  color: var(--text);
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
  font-size: 13px;
  max-width: calc(100vw - 32px);
  z-index: 10;
  text-align: left;
  right: 24px;
  width: 360px;
  border: 1px solid var(--line);
  line-height: 1.6;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
:root.dark {
  color-scheme: dark;
  --bg: #101012;
  --surface: #18181b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #27272a;
  --soft: #27272a;
  --primary: #f4f4f5;
  --on-primary: #18181b;
  --green: #4ac69a;
  --green-soft: #17352b;
  --orange: #dfa45e;
  --orange-soft: #382c20;
  --purple: #b39ae9;
  --purple-soft: #30263f;
  background: var(--bg);
  color: var(--text);
  --ring: #71717a;
  --destructive: #f87171;
  --destructive-soft: #7f1d1d33;
}
#json-dialog {
  width: 650px;
}
.json-content {
  padding: 24px;
}
.json-example {
  margin: 0;
  max-height: 340px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--soft);
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}
.json-example code,
.json-help code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.json-help {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
  margin-top: 17px;
}
.json-help p + p {
  margin-top: 9px;
}
.json-help code {
  font-size: 12px;
  background: var(--soft);
  border-radius: 3px;
  padding: 2px 4px;
  color: var(--text);
}
.file-actions {
  flex-wrap: wrap;
}
