* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  color: #222;
  max-width: 1100px;
}

header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

.actions {
  margin-left: auto;
}

button {
  font: inherit;
  cursor: pointer;
}

nav.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #ccc;
  margin: 1rem 0;
}

.tab {
  border: none;
  background: none;
  padding: 0.5rem 1rem;
  border-bottom: 2px solid transparent;
}

.tab.active {
  border-bottom-color: #333;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

th, td {
  padding: 0.4rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid #eee;
}

th:first-child, td:first-child {
  text-align: left;
}

th {
  font-weight: 600;
  color: #555;
}

.gain-pos { color: #0a7d23; }
.gain-neg { color: #b3261e; }
.muted { color: #999; }

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.3rem;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 3px;
}

.account-picker {
  margin: 0.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.account-picker select {
  font: inherit;
  padding: 0.3rem 0.4rem;
}

.cash-badge {
  color: #666;
  font-size: 0.95rem;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions button {
  margin-left: 0.25rem;
}

tr.editing td {
  background: #fafafa;
}

.txn-form {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #f6f6f6;
  border-radius: 4px;
}

.txn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.txn-row + .txn-row {
  margin-top: 0.5rem;
}

.txn-form input,
.txn-form select {
  flex: 1 1 8rem;
  width: auto;
}

.txn-form #txn-type {
  flex: 0 0 7rem;
  font: inherit;
  padding: 0.3rem 0.4rem;
}

.txn-form button {
  flex: 0 0 auto;
  padding: 0.4rem 0.8rem;
}

.signin {
  text-align: center;
  padding: 4rem 1rem;
  color: #666;
}

.empty {
  padding: 1rem 0;
  color: #666;
}

tr.grand-total td {
  border-top: 2px solid #333;
  border-bottom: none;
  padding-top: 0.6rem;
}
