/* ===== Segmented control ===== */
.segmented {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }

.segmented-btn {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--pill-inactive);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-ios), color var(--duration-fast) var(--ease-ios);
}

.segmented-btn.is-active {
  background: var(--text-primary);
  color: var(--text-on-white);
}

/* ===== Card ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md);
  margin-bottom: var(--space-md);
}

.total-card { padding: var(--space-lg) var(--space-md) 22px; }

.total-amount {
  margin: var(--space-xs) 0 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ===== Category rows (Analytics) ===== */
.category-list {
  display: flex;
  flex-direction: column;
}

.category-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.category-row:last-child { border-bottom: none; padding-bottom: 4px; }

.category-bar-accent {
  width: 3px;
  border-radius: var(--radius-pill);
  flex: 0 0 3px;
}

.category-row-body { flex: 1; min-width: 0; }

.category-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.category-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.category-emoji { font-size: 18px; line-height: 1; }

.category-amount { font-size: 16px; font-weight: 700; }

.progress-track {
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width var(--duration-base) var(--ease-ios);
}

.category-row-bottom {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.category-pct {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Tab bar ===== */
.tab-bar {
  flex: 0 0 auto;
  display: flex;
  background: rgba(20, 20, 22, 0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 8px calc(var(--safe-left)) calc(var(--safe-bottom)) calc(var(--safe-right));
  padding-top: 8px;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0 2px;
  color: var(--text-muted);
  transition: color var(--duration-fast) var(--ease-ios), transform var(--duration-fast) var(--ease-ios);
}

.tab-btn span { font-size: 11px; font-weight: 500; }

.tab-btn.is-active { color: var(--text-primary); }
.tab-btn.is-active span { font-weight: 700; }

.tab-btn:active { transform: scale(0.92); }

/* ===== Pill scroll (category selector on Tap screen) ===== */
.pill-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: var(--space-lg) 0 var(--space-md);
}
.pill-scroll::-webkit-scrollbar { display: none; }

.cat-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--pill-inactive);
  border: 1.5px solid transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  transition: border-color var(--duration-fast) var(--ease-ios), color var(--duration-fast) var(--ease-ios);
}

.cat-pill.is-selected {
  border-color: var(--pill-accent, var(--cat-food));
  color: var(--pill-accent, var(--cat-food));
  background: rgba(255,255,255,0.03);
}

/* ===== Note input ===== */
.note-toggle {
  color: var(--text-muted);
  font-size: 15px;
  padding: 4px 0;
}

.note-input {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  border: none;
  outline: none;
  margin-top: 4px;
}

.note-input::placeholder { color: var(--text-muted); }

/* ===== Numeric keypad ===== */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: var(--space-lg);
}

.key {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 18px 0;
  font-size: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: background var(--duration-fast) var(--ease-ios), transform var(--duration-fast) var(--ease-ios);
}

.key:active {
  background: var(--card-raised);
  transform: scale(0.96);
}

/* ===== Save button ===== */
.save-btn {
  width: 100%;
  margin-top: var(--space-lg);
  padding: 17px 0;
  border-radius: var(--radius-md);
  background: var(--pill-inactive);
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 700;
  transition: background var(--duration-fast) var(--ease-ios), color var(--duration-fast) var(--ease-ios), transform var(--duration-fast) var(--ease-ios);
}

.save-btn.is-ready {
  background: var(--text-primary);
  color: var(--text-on-white);
}

.save-btn:active { transform: scale(0.98); }

/* ===== History rows ===== */
.history-group { margin-bottom: var(--space-lg); }

.history-group-header {
  display: flex;
  justify-content: space-between;
  padding: 4px 2px 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.history-row:last-child { border-bottom: none; }

.history-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex: 0 0 44px;
}

.history-row-body {
  flex: 1;
  min-width: 0;
}

.history-row-name {
  font-size: 16px;
  font-weight: 600;
}

.history-row-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-row-right {
  text-align: right;
  flex: 0 0 auto;
}

.history-row-amount {
  font-size: 16px;
  font-weight: 700;
}

.history-row-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-total-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-top: var(--space-sm);
}

.history-total-label {
  font-size: 15px;
  color: var(--text-muted);
}

.history-total-amount {
  font-size: 20px;
  font-weight: 700;
}

.history-total-amount .of-budget {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
