:root {
  --bg: #f6f6f6;
  --fg: #1a1a1a;
  --muted: #666;
  --line: #ccc;
  --card: #fff;
  --accent: #2563eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
  font-size: 15px;
}
header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
h1 { margin: 0; font-size: 1.1rem; font-weight: 600; }
main { max-width: 52rem; margin: 0 auto; padding: 1.25rem; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
label { font-size: 0.82rem; color: var(--muted); display: block; margin-bottom: 0.25rem; }
input[type="date"] {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
button {
  padding: 0.45rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
.range-hint { font-size: 0.8rem; color: var(--muted); margin-bottom: 1rem; }
.err { color: #b91c1c; font-size: 0.9rem; margin: 0.5rem 0; }
ul.tx-list { list-style: none; padding: 0; margin: 0; }
.tx {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
}
.tx-head {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  justify-content: space-between; align-items: baseline;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.pill {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e8e8e8;
}
.pill.btc { background: #ffefd5; }
.pill.usd { background: #d9f5e7; }
.amounts {
  font-size: 0.88rem;
  margin-top: 0.35rem;
}
.amounts span { margin-right: 1rem; }
.notes {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.notes .k { color: var(--fg); font-weight: 500; margin-right: 0.35rem; }
.muted { color: var(--muted); font-size: 0.82rem; }
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.backdrop[hidden] {
  display: none;
}
.dialog {
  background: var(--card);
  max-width: 28rem;
  width: 100%;
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.dialog h2 { margin: 0 0 0.5rem; font-size: 1rem; }
.dialog p { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--muted); }
.dialog input[type="password"],
.dialog input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.dialog .actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }
.empty { color: var(--muted); font-size: 0.95rem; }
.summary {
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.summary .grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
  margin-top: 0.35rem;
}
.summary .metric { color: var(--muted); font-size: 0.78rem; }
.summary .value { font-weight: 600; color: var(--fg); }
details.group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.65rem;
}
details.group > summary {
  cursor: pointer;
  padding: 0.55rem 0.15rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  list-style: none;
}
details.group > summary::-webkit-details-marker { display: none; }
details.group .meta { color: var(--muted); font-size: 0.82rem; }
.warning-title { margin: 0 0 0.35rem; color: #7c2d12; font-weight: 600; }
.warning-wrap {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
}
.warning-wrap ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.warning-wrap li { margin: 0.25rem 0; }

.header-actions { display: flex; gap: 0.5rem; align-items: center; }
button.ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
