* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #222;
  font-size: 15px;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 18px;
  font-weight: 700;
}

nav a {
  text-decoration: none;
  color: #888;
  font-size: 14px;
  margin-left: 16px;
  font-weight: 500;
}

nav a.active {
  color: #111;
}

main {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}

/* Upload */
.upload-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.upload-btn {
  display: inline-block;
  background: #111;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.upload-btn:hover {
  background: #333;
}

#upload-status {
  font-size: 13px;
  color: #555;
}

#upload-status.success { color: #2a7a2a; }
#upload-status.error   { color: #c00; }

/* Transaction rows */
.tx-row {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.tx-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.tx-merchant {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 12px;
  color: #888;
}

.tx-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tx-amount {
  font-size: 14px;
  font-weight: 600;
  min-width: 64px;
  text-align: right;
}

.tx-amount.expense { color: #c00; }
.tx-amount.income  { color: #2a7a2a; }

/* Tag buttons */
.tag-buttons {
  display: flex;
  gap: 5px;
}

.tag-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #999;
  transition: all 0.15s;
}

.tag-btn:hover {
  border-color: #aaa;
  color: #333;
}

.tag-btn.active.tag-T { background: #4a90d9; border-color: #4a90d9; color: #fff; }
.tag-btn.active.tag-B { background: #e07b39; border-color: #e07b39; color: #fff; }
.tag-btn.active.tag-J { background: #5aab6e; border-color: #5aab6e; color: #fff; }

/* Totals page */
.month-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.month-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 12px;
}

.month-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.month-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-label {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.tag-label.tag-T  { background: #4a90d9; }
.tag-label.tag-B  { background: #e07b39; }
.tag-label.tag-J  { background: #5aab6e; }
.tag-label.tag-un { background: #bbb; }

.month-bar-wrap {
  flex: 1;
  background: #f0f0f0;
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}

.month-bar {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.bar-T  { background: #4a90d9; }
.bar-B  { background: #e07b39; }
.bar-J  { background: #5aab6e; }
.bar-un { background: #ccc; }

.month-amount {
  font-size: 13px;
  font-weight: 600;
  min-width: 72px;
  text-align: right;
}

.month-amount.muted { color: #aaa; }

.month-total {
  font-size: 13px;
  color: #888;
  text-align: right;
  border-top: 1px solid #f0f0f0;
  padding-top: 10px;
}

/* Login page */
.login-wrap {
  max-width: 340px;
  margin: 100px auto;
  text-align: center;
  padding: 0 20px;
}

.login-wrap h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

.login-wrap p {
  color: #888;
  margin-bottom: 32px;
  font-size: 15px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  color: #222;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.google-btn:hover {
  background: #f9f9f9;
}

#logout-btn {
  color: #aaa;
  font-size: 13px;
}

/* Misc */
.empty {
  text-align: center;
  color: #999;
  margin-top: 40px;
  font-size: 14px;
}

#loading {
  text-align: center;
  color: #999;
  margin-top: 40px;
  font-size: 14px;
}
